[HACKERS] How to determine that a TransactionId is really aborted? - Mailing list pgsql-hackers

From Eric Ridge
Subject [HACKERS] How to determine that a TransactionId is really aborted?
Date
Msg-id 75FF3934-2F85-4E19-8F9C-B77B08F7DD11@gmail.com
Whole thread Raw
Responses Re: [HACKERS] How to determine that a TransactionId is really aborted?
Re: [HACKERS] How to determine that a TransactionId is really aborted?
List pgsql-hackers
When sitting inside an extension, and given an arbitrary TransactionId, how can you determine that it aborted/crashed
*and*that no other active transaction thinks it is still running? 

I've tried to answer this question myself (against the 9.3 sources), and it seems like it's just:

{  TransactionId oldestXmin = GetOldestXmin (false, false);  TransactionId xid = 42;   if (TransactionIdPrecedes(xid,
oldestXmin)&&      !TransactionIdDidCommit(xid) &&      !TransactionIdIsInProgress(xid)) /* not even sure this is
necessary?*/  {     /* xid is aborted/crashed and no active transaction cares */  } 
}

Can anyone confirm or deny that this is correct?  I feel like it is correct, but I'm no expert.

Thanks so much for your time!

eric

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Useless(?) asymmetry in parse_func.c
Next
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] How to determine that a TransactionId is really aborted?