]> granicus.if.org Git - postgresql/commitdiff
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:36 +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 3551d94e223b829e5a01ebeb1079ce2e018de245..0106cdf63804e9d231b14a3ca699b6311d8f507d 100644 (file)
@@ -3079,7 +3079,7 @@ XLogFileInit(XLogSegNo logsegno, bool *use_existent, bool use_lock)
 {
        char            path[MAXPGPATH];
        char            tmppath[MAXPGPATH];
-       char            zbuffer_raw[BLCKSZ + MAXIMUM_ALIGNOF];
+       char            zbuffer_raw[XLOG_BLCKSZ + MAXIMUM_ALIGNOF];
        char       *zbuffer;
        XLogSegNo       installed_segno;
        int                     max_advance;
@@ -3139,7 +3139,7 @@ XLogFileInit(XLogSegNo logsegno, bool *use_existent, bool use_lock)
         * 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;