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

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access
Date: 2026-03-02 04:08:02
Message-ID: A0249625-0EF4-4068-854F-0592139DFBC1@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mar 2, 2026, at 10:34, Sami Imseih <samimseih(at)gmail(dot)com> wrote:
>
>> New version attached.
>
> The comment here:
>
> +static inline MultiXactId *
> +PreparedXactOldestMemberMXactIdSlot(ProcNumber procno)
> +{
> + /*
> + * The entries with indexes >= MaxBackends in the OldestMemberMXactId
> + * array are reserved for regular backends.
>
> should say "array are reserved for prepared transactions"
>

+1

And I saw the other code comment in multixact.c around line 162 needs an update because of this patch:
```
* Per-backend data starts here. We have two arrays stored in the area
* immediately following the MultiXactStateData struct. Each is indexed by
* ProcNumber.
```

It says “Each is indexed by ProcNumber”, but it’s no longer accurate for OldestMemberMXactId prepared-xact entries, which now use index (procno - FIRST_PREPARED_XACT_PROC_NUMBER).

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 David G. Johnston 2026-03-02 04:10:52 Re: pg_plan_advice
Previous Message Corey Huinker 2026-03-02 04:03:42 Re: Add starelid, attnum to pg_stats and leverage this in pg_dump