Re: Re: redo failed in physical streaming replication while stopping the master server

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: wcting <wcting163(at)163(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: redo failed in physical streaming replication while stopping the master server
Date: 2016-03-03 07:19:40
Message-ID: CAB7nPqQNh=jdzWO371FHC7MPZK9x5WoFfpuvi6tZ2YYQ0DJZUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 2, 2016 at 4:25 PM, wcting <wcting163(at)163(dot)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. The Assert checks that
* we're not scribbling on caller's record pointer; it's OK because we
* can only get here 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-03-03 07:47:27 Re: Confusing with commit time usage in logical decoding
Previous Message Craig Ringer 2016-03-03 07:11:48 Re: TAP / recovery-test fs-level backups, psql enhancements etc