pg_upgrade silently truncates nextMultiOffset to 32 bits

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Subject: pg_upgrade silently truncates nextMultiOffset to 32 bits
Date: 2026-08-27 00:59:40
Message-ID: CAD21AoCvzerscfU8o4ARQ793yAGHpQ72r2x5apeC_W2-k=SLCQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,
(CCing Heikki as the committer of commit bd8d9c9bdfa)

Commit bd8d9c9bdfa widened MultiXactOffset to uint64, but I found that
pg_upgrade still reads it as a uint32 value when reading the
pg_controldata continents:

else if ((p = strstr(bufin, "Latest checkpoint's NextMultiOffset:")) != NULL)
{
:
p++; /* remove ':' char */
cluster->controldata.chkpnt_nxtmxoff = str2uint(p);

I think it should use strtou64() instead. The attached 0001 patch
fixes it. It introduces str2uint64() as other fields are read by a
similar helper function str2uint().

Also, when checking other similar codes around the new
MultiXactOffset, I found that pg_control_checkpoint() still reports
the value as an xid. I think we should report it as bigint instead.
What do you think? The attached 0002 patch fixes it.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
0002-Report-next_multi_offset-as-bigint-in-pg_control_che.patch text/x-patch 2.7 KB
0001-pg_upgrade-Read-nextMultiOffset-as-a-64-bit-value.patch text/x-patch 1.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message dbryan.green 2026-08-27 01:04:15 Re: COPY FROM with RLS
Previous Message Richard Guo 2026-08-27 00:51:39 Re: remove_useless_joins vs. bug #19560