Subject: pgsql: Fix self-deadlock when replaying WAL generated by older minor ve

From: Heikki Linnakangas <[email-masked]>
Date: Wed, 27 May 2026 09:06:36 +0000

Fix self-deadlock when replaying WAL generated by older minor version

Commit 77dff5d937 introduced a SimpleLruWriteAll() call when replaying
multixact WAL records generated by older minor versions. However,
SimpleLruWriteAll() acquires the SLRU lock and on v16 and below, it's
called while already holding the lock, leading to self-deadlock.
Version 17 and 18 did not have that problem, because in those versions
the lock is acquired later in the function.

To fix, acquire MultiXactOffsetSLRULock later in RecordNewMultiXact(),
at the same place where it's acquired on version 17 and 18.

Author: Andrey Borodin <[email-masked]>
Reported-by: Radim Marek <[email-masked]>
Discussion: https://www.postgresql.org/message-id/[email-masked]
Backpatch-through: 14-16

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/42a3194e548349b658a808347df3d3d5e6b968af

Modified Files
--------------
src/backend/access/transam/multixact.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)