Re: age(xid) on hot standby - Mailing list pgsql-hackers

From Tom Lane
Subject Re: age(xid) on hot standby
Date
Msg-id 27775.1326916546@sss.pgh.pa.us
Whole thread Raw
In response to Re: age(xid) on hot standby  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: age(xid) on hot standby  (Simon Riggs <simon@2ndQuadrant.com>)
Re: age(xid) on hot standby  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> On mån, 2012-01-16 at 22:59 -0300, Alvaro Herrera wrote:
>> So who's going to work on a patch?  Peter, are you?  If not, we should
>> add it to the TODO list.

> Not at this very moment, but maybe in a few weeks.

BTW, it strikes me that maybe the coding should work about like this:
if (!TransactionIdIsValid(age_reference_xid)){    age_reference_xid = GetTopTransactionIdIfAny();    if
(!TransactionIdIsValid(age_reference_xid))       age_reference_xid = ReadNewTransactionId();}... use age_reference_xid
tocompute result ...
 

and of course code somewhere to reset age_reference_xid at end of xact.

The advantage of this is

(1) same code works on master and standby

(2) calling age() no longer requires an otherwise read-only transaction
to acquire an XID.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Setting -Werror in CFLAGS
Next
From: Alvaro Herrera
Date:
Subject: Re: foreign key locks, 2nd attempt