Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint) - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint)
Date
Msg-id CANP8+jJ3vq_12=Nx-Kz8v5CJvUgv=Ocm34fs3BL-Oz+XBO3Gyg@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint)  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint)  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint)  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
On 22 March 2017 at 17:41, Robert Haas <robertmhaas@gmail.com> wrote:

> +        if (TransactionIdIsCurrentTransactionId(xid))
> +            status = gettext_noop("in progress");
> +        else if (TransactionIdDidCommit(xid))
> +            status = gettext_noop("committed");
> +        else if (TransactionIdDidAbort(xid))
> +            status = gettext_noop("aborted");
> +        else
> +
> +            /*
> +             * can't test TransactionIdIsInProgress here or we race with
> +             * concurrent commit/abort. There's no point anyway, since it
> +             * might then commit/abort just after we check.
> +             */
> +            status = gettext_noop("in progress");
>
> I am not sure this is going to do the right thing for transactions
> that are aborted by a crash without managing to write an abort record.

Yes, perhaps we should report that state as "aborted - incomplete".

And of course, we might return "subcommitted" also, which could
technically also be an abort in some cases, so we'd need to do a wait
loop on that.

Which makes me think it would be confusing to say "in progress" for
when it is our current xid, since the user might wait until it is
complete and then wait forever. Prefer it if it said "in progress -
current transaction"

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] increasing the default WAL segment size
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] [PATCH v1] Add and report the new "in_hot_standby" GUC pseudo-variable.