Skip to content

Commit a4c4e0b

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 2b3136d commit a4c4e0b

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
@@ -2449,7 +2449,7 @@ XLogFileInit(uint32 log, uint32 seg,
24492449
{
24502450
char path[MAXPGPATH];
24512451
char tmppath[MAXPGPATH];
2452-
char zbuffer_raw[BLCKSZ + MAXIMUM_ALIGNOF];
2452+
char zbuffer_raw[XLOG_BLCKSZ + MAXIMUM_ALIGNOF];
24532453
char *zbuffer;
24542454
uint32 installed_log;
24552455
uint32 installed_seg;
@@ -2511,7 +2511,7 @@ XLogFileInit(uint32 log, uint32 seg,
25112511
* cycles transferring data to the kernel.
25122512
*/
25132513
zbuffer = (char *) MAXALIGN(zbuffer_raw);
2514-
memset(zbuffer, 0, BLCKSZ);
2514+
memset(zbuffer, 0, XLOG_BLCKSZ);
25152515
for (nbytes = 0; nbytes < XLogSegSize; nbytes += XLOG_BLCKSZ)
25162516
{
25172517
errno = 0;

0 commit comments

Comments
 (0)