Re: TransactionIdIsInProgress() cache - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: TransactionIdIsInProgress() cache
Date
Msg-id 20080311141545.GE9116@alvh.no-ip.org
Whole thread Raw
In response to Re: TransactionIdIsInProgress() cache  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: "Heikki Linnakangas"
Date:
Subject: Re: [PERFORM] Very slow (2 tuples/second) sequentialscan after bulk insert; speed returns to ~500 tuples/second aftercommit
Next
From: Larry Rosenman
Date:
Subject: Re: [HACKERS] Fix for large file support (nonsegment mode support)