Use correctly-sized buffer when zero-filling a WAL file.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 16 Apr 2014 07:21:09 +0000 (10:21 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 16 Apr 2014 07:27:16 +0000 (10:27 +0300)
I mixed up BLCKSZ and XLOG_BLCKSZ when I changed the way the buffer is
allocated a couple of weeks ago. With the default settings, they are both
8k, but they can be changed at compile-time.

src/backend/access/transam/xlog.c

index 35904f4b2c20ca8f5f1f5d77921f8cfbb7c57dcf..2a999236875acc028a935b065a0980bff1d9c1f3 100644 (file)
@@ -2167,7 +2167,7 @@ XLogFileInit(uint32 log, uint32 seg,
 {
    char        path[MAXPGPATH];
    char        tmppath[MAXPGPATH];
-   char        zbuffer_raw[BLCKSZ + MAXIMUM_ALIGNOF];
+   char        zbuffer_raw[XLOG_BLCKSZ + MAXIMUM_ALIGNOF];
    char       *zbuffer;
    uint32      installed_log;
    uint32      installed_seg;
@@ -2229,7 +2229,7 @@ XLogFileInit(uint32 log, uint32 seg,
     * cycles transferring data to the kernel.
     */
    zbuffer = (char *) MAXALIGN(zbuffer_raw);
-   memset(zbuffer, 0, BLCKSZ);
+   memset(zbuffer, 0, XLOG_BLCKSZ);
    for (nbytes = 0; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ)
    {
        errno = 0;