Re: prevent immature WAL streaming - Mailing list pgsql-hackers

From Tom Lane
Subject Re: prevent immature WAL streaming
Date
Msg-id 318012.1637871134@sss.pgh.pa.us
Whole thread Raw
In response to Re: prevent immature WAL streaming  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: prevent immature WAL streaming
Re: prevent immature WAL streaming
List pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2021-Nov-25, Tom Lane wrote:
>> Really?  AFAICS the WAL record contains the correct value, or at least
>> we should define that one as being correct, for precisely this reason.

> I don't know what is the correct value for a record that comes exactly
> after the page header.  But here's a patch that fixes the problem; and
> if a standby replays WAL written by an unpatched primary, it will be
> able to read past instead of dying of FATAL.

Meh ... but given the simplicity of the write-side fix, maybe changing
it is appropriate.

However, this seems too forgiving:

+    if (xlrec->overwritten_lsn != state->overwrittenRecPtr &&
+        xlrec->overwritten_lsn - SizeOfXLogShortPHD != state->overwrittenRecPtr &&
+        xlrec->overwritten_lsn - SizeOfXLogLongPHD != state->overwrittenRecPtr)

The latter two cases should only be accepted if overwrittenRecPtr is
exactly at a page boundary.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Non-superuser subscription owners
Next
From: Tom Lane
Date:
Subject: Re: prevent immature WAL streaming