public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andrey Borodin <[email protected]>
To: Michael Paquier <[email protected]>
Cc: Ayush Tiwari <[email protected]>
Cc: Radim Marek <[email protected]>
Cc: Heikki Linnakangas <[email protected]>
Cc: Marko Tiikkaja <[email protected]>
Cc: PostgreSQL mailing lists <[email protected]>
Subject: Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8
Date: Tue, 26 May 2026 14:33:11 +0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<CAL9smLBMxKBCmsA9UGcmf93bT2_MsZ+POH-oHREuwKdmMU7jfQ@mail.gmail.com>
<[email protected]>
<CAJgoLkJfFgL-V+pYB7=R81AbURTE6sMhzVHDQDhVGnfXRSJ9Wg@mail.gmail.com>
<CAJgoLkKCu0wCwPQZSo5no=XATU-4LMK4QfKBwV928o2uKcxe=g@mail.gmail.com>
<CAJTYsWU6tdEvVh4YKLxz7+amZ7+Wb7_s-FBjsMMeLNj1fKeSNg@mail.gmail.com>
<[email protected]>
<CAJTYsWWXvbBJe+WYJZcnoSTyVz9vk5ro3x2qAq_uvXvK2KwaMQ@mail.gmail.com>
<[email protected]>
<[email protected]>
> On 26 May 2026, at 14:27, Michael Paquier <[email protected]> wrote:
>
> Hmm, okay. I am not sure what you mean here, could you demonstrate
> your idea with a patch later?
Something like attached, not tested yet, working on an automated test.
Best regards, Andrey Borodin.
Attachments:
[application/octet-stream] demo.diff (1.9K, 2-demo.diff)
download | inline diff:
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index f825579e888..8899d5ac63d 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -888,8 +888,6 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
MultiXactOffset *next_offptr;
MultiXactOffset next_offset;
- LWLockAcquire(MultiXactOffsetSLRULock, LW_EXCLUSIVE);
-
/* position of this multixid in the offsets SLRU area */
pageno = MultiXactIdToOffsetPage(multi);
entryno = MultiXactIdToOffsetEntry(multi);
@@ -907,6 +905,9 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
* multixid was assigned. If we're replaying WAL that was generated by
* such a version, the next page might not be initialized yet. Initialize
* it now.
+ *
+ * This block runs before acquiring MultiXactOffsetSLRULock because
+ * SimpleLruWriteAll() needs to acquire the same lock internally.
*/
if (InRecovery && next_pageno != pageno)
{
@@ -951,6 +952,8 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
{
elog(DEBUG1, "next offsets page is not initialized, initializing it now");
+ LWLockAcquire(MultiXactOffsetSLRULock, LW_EXCLUSIVE);
+
/* Create and zero the page */
slotno = SimpleLruZeroPage(MultiXactOffsetCtl, next_pageno);
@@ -958,6 +961,8 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
SimpleLruWritePage(MultiXactOffsetCtl, slotno);
Assert(!MultiXactOffsetCtl->shared->page_dirty[slotno]);
+ LWLockRelease(MultiXactOffsetSLRULock);
+
/*
* Remember that we initialized the page, so that we don't zero it
* again at the XLOG_MULTIXACT_ZERO_OFF_PAGE record.
@@ -967,6 +972,8 @@ RecordNewMultiXact(MultiXactId multi, MultiXactOffset offset,
}
}
+ LWLockAcquire(MultiXactOffsetSLRULock, LW_EXCLUSIVE);
+
/*
* Set the starting offset of this multixid's members.
*
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox