Re: txid_status returns NULL for recently commited transactions - Mailing list pgsql-hackers

From Michail Nikolaev
Subject Re: txid_status returns NULL for recently commited transactions
Date
Msg-id CANtu0ohkqZY4_u-6H5hUoR7Rka0tfy-fmH-MpyX4Ar15qmgRnA@mail.gmail.com
Whole thread Raw
In response to Re: txid_status returns NULL for recently commited transactions  (Andres Freund <andres@anarazel.de>)
Responses Re: txid_status returns NULL for recently commited transactions  (Michail Nikolaev <michail.nikolaev@gmail.com>)
List pgsql-hackers
Hi, thanks for the reply!

> What are you using it for?

I want to use it to validate status of related entities in other database (queue) in short interval after PG transaction commit/rollback.

> I can't reproduce that...

Yes, it happens only with one cluster. All others work as expected.

> Your mailer appears to do very annoying things by converting numbers to
phone numbers.

Sorry.

> It's from the last epoch. Plain xids are 32bit wide, the epochs deal
> with values that are bigger. And 2207340131 is less than 2^31 in the
> past.

Yes, and probably it is cause of the issue.

ShmemVariableCache->oldestClogXid = 2207340131
xid_epoch = 1
xid = 150227913
TransactionIdPrecedes(xid, ShmemVariableCache->oldestClogXid)) return TRUE , then TransactionIdInRecentPast return FALSE and txtd_status return NULL.

But xid (1) and xid_epoch (150227913) are correct values from my active (or recently commited) transaction.

>> SELECT txid_status(BIGINT '4294967295') -> 'commited'.
>> SELECT txid_status(BIGINT '4294967296') -> NULL
> Why do you think that is the wrong result?

Let's leave it for now (maybe my misunderstanding). I think it is better to deal with "txid_status(txid_current()) -> NULL" issue first.

Thanks,
Michail.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: txid_status returns NULL for recently commited transactions
Next
From: Andres Freund
Date:
Subject: Re: Query is over 2x slower with jit=on