Re: Fix bug in multixact Oldest*MXactId initialization and access

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Andres Freund <andres(at)anarazel(dot)de>, Sami Imseih <samimseih(at)gmail(dot)com>
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access
Date: 2026-02-27 07:48:17
Message-ID: 7D765C95-0FF5-4A7D-9C4F-B8DF0CB24906@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Feb 27, 2026, at 00:22, Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hüseyin Demir 2026-02-27 07:53:27 Re: Add pg_get_publication_ddl function
Previous Message Mahendra Singh Thalor 2026-02-27 07:47:43 Re: pg_restore add --no-globals option when restored using pg_dumpall non-text dump