Skip to content

Commit c03a6ae

Browse files
committed
Use correctly-sized buffer when zero-filling a WAL file.
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.
1 parent 3b8fda6 commit c03a6ae

File tree

1 file changed

+2
-2
lines changed
  • src/backend/access/transam

1 file changed

+2
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ XLogFileInit(XLogSegNo logsegno, bool *use_existent, bool use_lock)
22472247
{
22482248
char path[MAXPGPATH];
22492249
char tmppath[MAXPGPATH];
2250-
char zbuffer_raw[BLCKSZ + MAXIMUM_ALIGNOF];
2250+
char zbuffer_raw[XLOG_BLCKSZ + MAXIMUM_ALIGNOF];
22512251
char *zbuffer;
22522252
XLogSegNo installed_segno;
22532253
int max_advance;
@@ -2307,7 +2307,7 @@ XLogFileInit(XLogSegNo logsegno, bool *use_existent, bool use_lock)
23072307
* cycles transferring data to the kernel.
23082308
*/
23092309
zbuffer = (char *) MAXALIGN(zbuffer_raw);
2310-
memset(zbuffer, 0, BLCKSZ);
2310+
memset(zbuffer, 0, XLOG_BLCKSZ);
23112311
for (nbytes = 0; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ)
23122312
{
23132313
errno = 0;

0 commit comments

Comments
 (0)