]> 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:46 +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 ff19218f5ba0f8247556b8d246912d39436d1987..9deadf9ed9e7e5d492c8e20cd2e328bce1d63c2b 100644 (file)
@@ -2247,7 +2247,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;
@@ -2307,7 +2307,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;