]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix determination of broken LSN in OVERWRITTEN_CONTRECORD
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 26 Nov 2021 14:14:27 +0000 (11:14 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 26 Nov 2021 14:14:27 +0000 (11:14 -0300)
In commit ff9f111bce24 I mixed up inconsistent definitions of the LSN of
the first record in a page, when the previous record ends exactly at the
page boundary.  The correct LSN is adjusted to skip the WAL page header;
I failed to use that when setting XLogReaderState->overwrittenRecPtr,
so at WAL replay time VerifyOverwriteContrecord would refuse to let
replay continue past that record.

Backpatch to 10.  9.6 also contains this bug, but it's no longer being
maintained.

Discussion: https://postgr.es/m/45597.1637694259@sss.pgh.pa.us

src/backend/access/transam/xlogreader.c

index 8e78013b7a2d503071c56108d201d4ddb4b6d033..3ecacb592edb11b2e5fe45eac05cac78971f0633 100644 (file)
@@ -414,7 +414,7 @@ restart:
                         */
                        if (pageHeader->xlp_info & XLP_FIRST_IS_OVERWRITE_CONTRECORD)
                        {
-                               state->overwrittenRecPtr = state->currRecPtr;
+                               state->overwrittenRecPtr = RecPtr;
                                ResetDecoder(state);
                                RecPtr = targetPagePtr;
                                goto restart;