Re: POC: make mxidoff 64 bits - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: POC: make mxidoff 64 bits
Date
Msg-id 2c7d4202-31d4-4254-8ed0-484083b14624@iki.fi
Whole thread Raw
In response to Re: POC: make mxidoff 64 bits  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: POC: make mxidoff 64 bits
Re: POC: make mxidoff 64 bits
List pgsql-hackers
On 11/12/2025 05:06, Ashutosh Bapat wrote:
> On Thu, Dec 11, 2025 at 12:49 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>>
>> On 09/12/2025 14:00, Heikki Linnakangas wrote:
>>> 1. Currently, at multixid wraparound, MultiXactState->nextMXact goes to
>>> 0, which is invalid. All the readers must be prepared for that, and skip
>>> over the 0. That's error-prone, we've already missed that a few times.
>>> Let's change things so that the code that *writes* MultiXactState-
>>>   >nextMXact skips over the zero already.
>>
>> Here's a patch for that. Does anyone see a problem with this?
> 
> The patch looks fine to me. It simplifies readers without affecting
> writers much. I was expecting more explanation of why it wasn't done
> that way to start with and why is it safe to do so (now, if
> applicable). There must be a reason why we chose to make readers
> handle invalid mxid instead of writers writing one. If it's for
> performance reasons then does the new arrangement cause any
> regression? If it's for safety reasons, are we fixing one set of
> problems but introducing a new set. I was expecting commit message to
> answer those questions.

That's a great question and I've been wondering about it myself. It goes 
all the way to the initial commit where multixacts were introduced, and 
I don't see any particular reason for it even back then. Even in the 
very first version of multixact.c, IMO it would've been simpler to have 
the writer handle the wraparound.

Álvaro, would you happen to remember?

- Heikki




pgsql-hackers by date:

Previous
From: David Geier
Date:
Subject: Re: Consistently use palloc_object() and palloc_array()
Next
From: Ioseph Kim
Date:
Subject: Re: Re: Propose: Adding a '--enable-failover' option to 'pg_createsubscriber' ver.3