Re: BUG #18212: Functions txid_status() and pg_xact_status() return invalid status of the specified transaction - Mailing list pgsql-bugs

From Karina Litskevich
Subject Re: BUG #18212: Functions txid_status() and pg_xact_status() return invalid status of the specified transaction
Date
Msg-id CACiT8iYGisogHuEUvwwY44HjXDw8hNEoCw7QvhsYjOVqp2P5JQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18212: Functions txid_status() and pg_xact_status() return invalid status of the specified transaction  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: BUG #18212: Functions txid_status() and pg_xact_status() return invalid status of the specified transaction  (Alexander Korotkov <aekorotkov@gmail.com>)
List pgsql-bugs

On Tue, Nov 28, 2023 at 8:20 AM Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote:
I considered bringing this down to a comparison of 32-bit XIDs, but
couldn't come up with a clean method. Therefore, using full XID seems
to be the right approach. However, it seems like there is an error in
the XID comparison condition. There are cases where oldest_xid and
now_epoch_next_xid can have the same value. If we skip running
txid_current() in the repro in the your previous mail, and directly
execute txid_status(3), it would lead to assertion failure.
 
Thank you for your feedback! You're right, I haven't thought about
this corner case. Fixed in v2.

Also, I feel the comments could be more straight forward and simple
like this:

> Convert oldest_xid into a full XID to compare with the given
> XID. Alghouth it's guaranteed that the the oldest and newest XIDs
> are within the XID wraparound distance, they may have different
> epochs.

I tried to improve the comment too. Anyway, don't hesitate to change
it to whatever you like better.

Best regards,
Karina Litskevich
Postgres Professional: http://postgrespro.com/ 
Attachment

pgsql-bugs by date:

Previous
From: Gurjeet Singh
Date:
Subject: Re: Fwd: BUG #18016: REINDEX TABLE failure
Next
From: Sandeep Thakkar
Date:
Subject: Re: BUG #18198: Constantly getting errors