pgsql: pg_upgrade: Fix last multixid ending at offset wraparound

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_upgrade: Fix last multixid ending at offset wraparound
Date: 2026-10-16 14:38:46
Message-ID: E1xHj54-00000001srK-0r6T@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_upgrade: Fix last multixid ending at offset wraparound

On v18 and below, if the newest multixid's members end exactly at the
the 32-bit offset wraparound point, the next offset in the control
file is 0. GetOldMultiXactIdSingleMember() treated that as an invalid
entry and dropped the multixid's members, so after upgrade accessing
the tuple failed with "MultiXact N has invalid offset".

To fix, only check for zero offset when it was read from the next
multixid's slot, like GetMultiXactIdMembers() did in v18. This is
unlikely to happen in practice, but better to get it right.

The bug came with commit bd8d9c9bdfa in v19.

Author: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Discussion: https://www.postgresql.org/message-id/CAN4CZFM8BCazGz6s1Vn5tMEXYiXE2fi8T2rwmwXSty5gD+h9rA@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2323f03a1789bc52bee980c56b8057470458701a

Modified Files
--------------
src/bin/pg_upgrade/multixact_read_v18.c | 17 +++++----
src/bin/pg_upgrade/t/007_multixact_conversion.pl | 44 ++++++++++++++++++++++++
2 files changed, 55 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-10-16 15:15:21 pgsql: Avoid unnecessary end-of-recovery barrier waits
Previous Message Tom Lane 2026-10-16 14:05:55 pgsql: Allow role created by new test to log in on Windows.