Re: Fix for consume_xids advancing XIDs incorrectly

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: João Rito <joaovictor(dot)rito(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, sawada(dot)mshk(at)gmail(dot)com, michael(at)paquier(dot)xyz
Subject: Re: Fix for consume_xids advancing XIDs incorrectly
Date: 2026-11-11 08:52:09
Message-ID: CAHGQGwHOGXf6aamh=tftLfazqHf-83KdCMtg8C-wtMoFGzUbiA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 11, 2026 at 7:53 AM João Rito <joaovictor(dot)rito(at)gmail(dot)com> wrote:
> Following Michael's request in January, I picked this one up since the
> thread has been idle for a while. I rebased the work onto current master
> and addressed the review comments Sawada-san posted on 2024-10-31.

Thanks for updating the patch! LGTM, except for one comment.

> I kept the "Returns the last XID assigned by this function" comment on
> consume_xids() and consume_xids_until(), as Fujii-san asked.

If the transaction already has a top-level XID and the next XID is
at least the target, consume_xids_until() returns that next XID
without assigning it. So isn't it better to update the comment for
consume_xids_until(), for example, as follows?

/*
* Advance XID allocation so that the next XID is at least the target.
* This may consume XIDs beyond the target.
*
* Ensures that the current transaction has a top-level XID.
* Returns the last XID assigned by this call, or the next XID observed
* if no XID was assigned.
*/

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-11-11 08:54:06 Re: [PATCH] Fix two client-side NULL dereferences on malformed result sets (libpq, pg_receivewal)
Previous Message shveta malik 2026-11-11 08:51:29 Re: Crashes on a partition whose concurrent detach never finished