Skip to content

Commit 01b9fa1

Browse files
author
Antonin Houska
committed
Do not check page header after XLOG switch.
The pages are zeroed till the end of the segment.
1 parent c73d01f commit 01b9fa1

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/wbfilter.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,29 @@ WbFProcessWalDataBlock(ReplMessage* msg, FilterData* fl, XLogRecPtr *retryPos)
7070

7171
XLogPageHeader header = (XLogPageHeader) ReplMessageConsume(msg,
7272
SizeOfXLogShortPHD);
73+
74+
msg->nextPageBoundary += XLOG_BLCKSZ;
75+
76+
/*
77+
* If we're copying the rest of the segment following XLOG switch,
78+
* we cannot examine the header because the switch record should
79+
* be followed only by zeroes. And in fact we do not need any
80+
* header info.
81+
*/
82+
if (fl->state == FS_COPY_SWITCH)
83+
{
84+
/* Subtract the amount already "consumed" above. */
85+
fl->dataNeeded -= SizeOfXLogShortPHD;
86+
/* Normal processing should continue now. */
87+
continue;
88+
}
89+
7390
if (header->xlp_magic < XLOG_PAGE_MAGIC_MIN || header->xlp_magic > XLOG_PAGE_MAGIC_MAX)
7491
error("Received page with invalid page magic");
7592

7693
if (header->xlp_info & XLP_LONG_HEADER)
7794
ReplMessageConsume(msg, SizeOfXLogLongPHD - SizeOfXLogShortPHD);
7895

79-
msg->nextPageBoundary += XLOG_BLCKSZ;
80-
8196
/*
8297
* Adjust recordStart so it does not point to the beginning of the
8398
* page.

0 commit comments

Comments
 (0)