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:26:54 +0000 (10:26 +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 2f715903245153198387ceee16cbacebe3c6ad64..77d599bf224039ecc9ef15ab99fc536845532aa3 100644 (file)
@@ -2449,7 +2449,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;
@@ -2511,7 +2511,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;