Re: Re: redo failed in physical streaming replication while stopping the master server - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Re: redo failed in physical streaming replication while stopping the master server
Date
Msg-id CAB7nPqQNh=jdzWO371FHC7MPZK9x5WoFfpuvi6tZ2YYQ0DJZUg@mail.gmail.com
Whole thread Raw
In response to Re: redo failed in physical streaming replication while stopping the master server  (wcting <wcting163@163.com>)
Responses Re: redo failed in physical streaming replication while stopping the master server
List pgsql-hackers
On Wed, Mar 2, 2016 at 4:25 PM, wcting <wcting163@163.com> wrote:
> /*
>                  * If at page start, we must skip over the page header.  But
> we can't
>                  * do that until we've read in the page, since the header
> size is
>                  * variable.
>                  */
>
> i don't know the meaning behind this comments,
>
>  if ((RecPtr->xrecoff % XLogSegSize) == 0)
> it's a long page header, else a short page header,
>
> so "the header size" can be calculated ? right?

This means that the page must be read first, before recalculating the
record pointer to be the first one after the page header. This is done
a little bit after in ReadRecord():   pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);   targetRecOff =
RecPtr->xrecoff% XLOG_BLCKSZ;   if (targetRecOff == 0)   {       /*        * At page start, so skip over page header.
TheAssert checks that        * we're not scribbling on caller's record pointer; it's OK because we        * can only
gethere in the continuing-from-prev-record case, since        * XRecOffIsValid rejected the zero-page-offset case
otherwise.       */       Assert(RecPtr == &tmpRecPtr);       RecPtr->xrecoff += pageHeaderSize;       targetRecOff =
pageHeaderSize;  }
 
And XLogPageHeaderSize() makes the difference between a long a short header.
-- 
Michael



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: TAP / recovery-test fs-level backups, psql enhancements etc
Next
From: Andres Freund
Date:
Subject: Re: Confusing with commit time usage in logical decoding