pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Chao Li <li.evan.chao@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Subject: Re: pg_upgrade silently truncates nextMultiOffset to 32 bits
Date: Thu, 27 Aug 2026 11:01:35 +0300
Message-ID: <f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi> (raw)
In-Reply-To: <D0710380-D4E2-431F-B761-B4FE58AE7266@gmail.com>
References: <CAD21AoCvzerscfU8o4ARQ793yAGHpQ72r2x5apeC_W2-k=SLCQ@mail.gmail.com>
	<D0710380-D4E2-431F-B761-B4FE58AE7266@gmail.com>

On 27/08/2026 10:06, Chao Li wrote:
>> On Aug 27, 2026, at 08:59, Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>>
>> 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.

Thanks, good catch!

> bigint is a signed int64, so it cannot represent the full uint64 range, although perhaps this is only a theoretical concern. If we want to avoid this limitation, should we use numeric instead?

xid8 seems like the most straightforward replacement. It's a little 
bogus as a multixact offset it's not really an XID. But we were using 
the 32-bit 'xid' type for it previously, it's in line with that.

I'll go do that. This requires bumping the catalog version, but since 
we've bumped it already since 19beta3, that's OK.

- Heikki





view thread (9+ messages)  latest in thread

Message-ID: <f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi>
Permalink:  ../f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi/
Also on:    postgresql.org/message-id/f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: hlinnaka@iki.fi, li.evan.chao@gmail.com, sawada.mshk@gmail.com, heikki.linnakangas@iki.fi
  Subject: Re: pg_upgrade silently truncates nextMultiOffset to 32 bits
  In-Reply-To: <f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi>
  References: <CAD21AoCvzerscfU8o4ARQ793yAGHpQ72r2x5apeC_W2-k=SLCQ@mail.gmail.com> <D0710380-D4E2-431F-B761-B4FE58AE7266@gmail.com> <f0acaf96-12d5-47ea-afde-9c7b02cd9abe@iki.fi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox