diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e71090f..d738144 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -985,7 +985,7 @@ begin:; /* * If there isn't enough space on the current XLOG page for a record - * header, advance to the next page (leaving the unused space as zeroes). + * header, advance to the next page. */ updrqst = false; freespace = INSERT_FREESPACE(Insert); @@ -1586,17 +1586,18 @@ AdvanceXLInsertBuffer(bool new_segment) Insert->currpos = ((char *) NewPage) +SizeOfXLogShortPHD; /* - * Be sure to re-zero the buffer so that bytes beyond what we've written - * will look like zeroes and not valid XLOG records... + * We used to zero the new buffer here but that is unnecessary because + * the WAL record chaining logic does not require it. The WAL files are + * reused repeatedly and frequently contain junk data, so our protection + * from reading old junk comes from the xl_prev link on each WAL record. */ - MemSet((char *) NewPage, 0, XLOG_BLCKSZ); /* * Fill the new page's header */ NewPage ->xlp_magic = XLOG_PAGE_MAGIC; - /* NewPage->xlp_info = 0; */ /* done by memset */ + NewPage ->xlp_info = 0; NewPage ->xlp_tli = ThisTimeLineID; NewPage ->xlp_pageaddr.xlogid = NewPageEndPtr.xlogid; NewPage ->xlp_pageaddr.xrecoff = NewPageEndPtr.xrecoff - XLOG_BLCKSZ;