From: Chao Li <li.evan.chao@gmail.com>
To: Yura Sokolov <y.sokolov@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andres Freund <andres@anarazel.de>
Cc: Sami Imseih <samimseih@gmail.com>
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access
Date: Fri, 27 Feb 2026 15:48:17 +0800
Message-ID: <7D765C95-0FF5-4A7D-9C4F-B8DF0CB24906@gmail.com> (raw)
In-Reply-To: <bf2951b4-687b-4bd3-a072-46deb463f177@postgrespro.ru>
References: <7acc94b0-ea82-4657-b1b0-77842cb7a60c@postgrespro.ru>
<93F0BD0A-0B8B-4592-9D4B-53F405A86F6A@gmail.com>
<c3eaaac1-d244-4e4d-b5d7-06c284108eac@postgrespro.ru>
<C991344D-F38A-4EEC-903A-72B52FF887FA@gmail.com>
<bf2951b4-687b-4bd3-a072-46deb463f177@postgrespro.ru>
> On Feb 27, 2026, at 00:22, Yura Sokolov <y.sokolov@postgrespro.ru> wrote:
>
>
> Chao Li, new access functions doen't branch because I've made separate
> functions to store at slots for prepared transactions.
>
```
+ OldestMemberMXactId[procno - MaxChildren + MaxBackends] = mxact;
```
Wow, this is clever. It removes NUM_AUXILIARY_PROCS from procno without introducing an extra if check.
However, I am not a big fan of the new global variable names:
```
MaxChildren = MaxBackends + NUM_AUXILIARY_PROCS;
TotalProcs = MaxChildren + max_prepared_xacts;
TotalXactProcs = MaxBackends + max_prepared_xacts;
```
MaxChildren is actually the total number of backends plus auxiliary processes. Maybe something like MaxProcs would better reflect that?
TotalProcs is really the length of the PGPROC array in shared memory. Prepared transactions are not real processes; they just occupy some slots in the proc array. So perhaps a name like MaxPGProcSlots or MaxBackendAndPreparedSlots would be more accurate.
As for TotalXactProcs, maybe something like MaxBackendAndPreparedSlots would make the intent clearer.
Anyway, I am not very good at naming things. You or others may have better suggestions.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: li.evan.chao@gmail.com, y.sokolov@postgrespro.ru, pgsql-hackers@lists.postgresql.org, hlinnaka@iki.fi, andres@anarazel.de, samimseih@gmail.com
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access
In-Reply-To: <7D765C95-0FF5-4A7D-9C4F-B8DF0CB24906@gmail.com>
* 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