Re: Race condition in TransactionIdIsInProgress - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Race condition in TransactionIdIsInProgress
Date
Msg-id CA+TgmoaTUg8B-hfj5N212yyb2GMxr2-4sZ=x_tKfui551NxOTw@mail.gmail.com
Whole thread Raw
In response to Race condition in TransactionIdIsInProgress  (Konstantin Knizhnik <knizhnik@garret.ru>)
Responses Re: Race condition in TransactionIdIsInProgress
List pgsql-hackers
On Thu, Feb 10, 2022 at 11:46 AM Konstantin Knizhnik <knizhnik@garret.ru> wrote:
> Postgres first records state transaction in CLOG, then removes
> transaction from procarray and finally releases locks.
> But it can happen that transaction is marked as committed in CLOG,
> XMAX_COMMITTED bit is set in modified tuple but
> TransactionIdIsInProgress still returns true. As a result "t_xmin %u is
> uncommitted in tuple (%u,%u) to be updated in table"
> error is reported.

This is exactly why the HeapTupleSatisfiesFOO() functions all test
TransactionIdIsInProgress() first and TransactionIdDidCommit() only if
it returns false. I don't think it's really legal to test
TransactionIdDidCommit() without checking TransactionIdIsInProgress()
first. And I bet that's exactly what this code is doing...

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "Joel Jacobson"
Date:
Subject: List of all* PostgreSQL EXTENSIONs in the world
Next
From: Robert Haas
Date:
Subject: Re: wrong fds used for refilenodes after pg_upgrade relfilenode changes Reply-To: