Thanks for your reply.

If we only take replay for consideration, yeah, we do this header check
until we've read the page first.

But thanks to the master xlog generator, we know that:
when we try advance XLOG insert buffer (page), we treate the new page header
as short header at first.
then we use this condition to make it a long header.

        if ((NewPage->xlp_pageaddr.xrecoff % XLogSegSize) == 0)
                XLogLongPageHeader NewLongPage = (XLogLongPageHeader) NewPage;

                NewLongPage->xlp_sysid = ControlFile->system_identifier;
                NewLongPage->xlp_seg_size = XLogSegSize;
                NewLongPage->xlp_xlog_blcksz = XLOG_BLCKSZ;
                NewPage   ->xlp_info |= XLP_LONG_HEADER;

                Insert->currpos = ((char *) NewPage) +SizeOfXLogLongPHD;

So in the replay scenario, before we read the page from wal segment file,
using the specical RecPtr which point to the next page header address, can
we predicat the page header is a long or short?



View this message in context:
Sent from the PostgreSQL - hackers mailing list archive at

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to