Re: [PATCH] Transaction traceability - txid_status(bigint)

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Álvaro Herrera <alvaro(dot)herrera(at)2ndquadrant(dot)com>
Subject: Re: [PATCH] Transaction traceability - txid_status(bigint)
Date: 2017-01-25 07:02:26
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On 25 January 2017 at 13:44, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
> On 24 January 2017 at 23:49, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I think it's fairly surprising that TruncateCLOG() has responsibility
>> for writing the xlog record that protects advancing
>> ShmemVariableCache->oldestXid, but not the responsibility for actually
>> advancing that value. In other words, I think the AdvanceOldestXid()
>> call in vac_truncate_clog() should be moved into TruncateClog().
>> (Similarly, one wonders why AdvanceOldestCommitTsXid() isn't the
>> responsibility of TruncateCommitTs().)
> Agreed, and done in attached.
> I haven't done the same for commit_ts but will do so on the thread for
> the commit_ts race fix if we go ahead with this change here.
>> I think it is not correct to advance oldestXid but not oldestXidDB.
>> Otherwise, GetNewTransactionId() might complain about the wrong
>> database.
> That's a clear oversight. Fixed in attached.

New attached also records it in xlog and applies it to the standby.

If we want to save the 4 bytes per xmin advance (probably not worth
caring) we can instead skip setting it on the standby, in which case
it'll be potentially wrong until the next checkpoint. I'd rather make
sure it stays correct.

Craig Ringer
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Fix-race-between-clog-truncation-and-lookup.patch text/x-patch 15.4 KB
0002-Introduce-txid_status-bigint-to-get-status-of-an-xac.patch text/x-patch 19.6 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2017-01-25 07:03:30 Re: I could not see any row in audit table
Previous Message Beena Emerson 2017-01-25 06:15:43 Re: \h tab-completion