]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.
authorNoah Misch <noah@leadboat.com>
Thu, 15 Sep 2022 13:45:23 +0000 (06:45 -0700)
committerMichael Paquier <michael@paquier.xyz>
Sun, 6 Apr 2025 06:40:44 +0000 (15:40 +0900)
After commit cc2c7d65fc27e877c9f407587b0b92d46cd6dd16 added this flag,
failure to reset it caused assertion failures.  In non-assert builds, it
made the system fail to achieve the objectives listed in that commit;
chiefly, we might emit a spurious log message.  Back-patch to v15, where
that commit first appeared.

Bharath Rupireddy and Kyotaro Horiguchi.  Reviewed by Dilip Kumar,
Nathan Bossart and Michael Paquier.  Reported by Dilip Kumar.

This commit has been applied as of b4f584f9d2a1 in v15 and newer
versions.  This is required on stable branches of v13 and v14 to fix a
regression reported by Noah Misch, introduced by 1f95181b44c8, causing
spurious failures in archive recovery (neither streaming nor archive
recovery) with concurrent restartpoints.  The backpatched versions of
the patches have been aligned on these branches by me.  Tests have been
conducted by the both of us.

Discussion: https://postgr.es/m/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com
Discussion: https://postgr.es/m/20250306193013.36.nmisch@google.com
Backpatch-through: 13

src/backend/access/transam/xlog.c

index c5fe7e6fa4cccabdb330636f5db8e0c22c3d87f7..9ce4297e3de6d311868952f37bc3155ce44dc0e0 100644 (file)
@@ -12799,8 +12799,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
                                         * walreceiver is not active, so that it won't overwrite
                                         * WAL that we restore from archive.
                                         */
-                                       if (WalRcvStreaming())
-                                               XLogShutdownWalRcv();
+                                       XLogShutdownWalRcv();
 
                                        /*
                                         * Before we sleep, re-scan for possible new timelines if