Re: How to determine that a TransactionId is really aborted?

From: Eric Ridge <eebbrr(at)gmail(dot)com>
To: Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to determine that a TransactionId is really aborted?
Date: 2017-10-22 21:19:58
Message-ID: CAB35990-C3B2-4EBD-8B7B-6DF58595D576@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Oct 22, 2017, at 2:50 PM, Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com> wrote:
>
> so, what you want is txid_status() [1]... while this is new in v10 you
> can use the code as guide or just migrate to v10 ;)

Oh neat, thanks.

<long pause reading the code>

Doesn't that tell you the status relative to the transaction calling txid_status()?

I'm looking for the status as any concurrent open transaction might see it. For example, if any concurrent transaction might see it as "in progress", that's what I'd want returned. Does that make sense?

That's why I was thinking GetOldestXmin() was the right thing to use rather than GetActiveSnapshot()->xmin and also why I thought to check TransactionIdPrecedes() first.

I am curious about the lock on ClogTruncationLock... could any of the TransactionIdDidXXX calls lie without that lock? I haven't seen such a thing used in the 9.3 sources. Maybe it's necessary for 10 or maybe I just missed it in 9.3?

Thanks for your time!

eric

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-10-22 21:24:26 Re: How to determine that a TransactionId is really aborted?
Previous Message Tom Lane 2017-10-22 21:11:09 Re: BUG #14849: jsonb_build_object doesn't like VARIADIC calls very much