Heikki Linnakangas wrote:
> Nope, that's not good. Per comments in tqual.c, you have to call
> TransactionIdIsInProgress *before* TransactionIdDidCommit, to avoid this
> race condition:
>
> 1. Xact A inserts a record
> 2. Xact B does TransactionIdDidCommit, which retuns false because it's
> still in progress
> 3. Xact B commits
> 4. Xact B does TransactionIdIsInProgress to see if A is still in
> progress. It returns false. We conclude that A aborted, while it
> actually committed.
Ah, right -- I knew there was a reason for the other coding, I just
didn't remember what it was and based my transformation purely on the
snippet you posted.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support