Skip site navigation (1) Skip section navigation (2)

Re: age(xid) on hot standby

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: age(xid) on hot standby
Date: 2012-01-16 14:44:01
Message-ID: 1326724812-sup-6496@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Peter Eisentraut's message of dom ene 15 10:00:03 -0300 2012:
> 
> On ons, 2011-12-28 at 14:35 -0500, Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > > Excerpts from Peter Eisentraut's message of mié dic 28 15:04:09 -0300 2011:
> > >> On a hot standby, this fails with:
> > >> ERROR:  cannot assign TransactionIds during recovery
> > 
> > > I think we could just have the xid_age call
> > > GetCurrentTransactionIdIfAny, and if that returns InvalidXid, use
> > > ReadNewTransactionId instead.  That xid_age assigns a transaction seems
> > > more of an accident than really intended.
> > 
> > The trouble with using ReadNewTransactionId is that it makes the results
> > volatile, not stable as the function is declared to be.
> 
> Could we alleviate that problem with some caching within the function?

Maybe if we have it be invalidated at transaction end, that could work.
So each new transaction would get a fresh value.  If you had a long
running transaction the cached value would get behind, but maybe this is
not a problem or we could design some protection against it.

For the check_postgres case I imagine it opens a new connection on each
round so this would not be a problem.

-- 
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2012-01-16 14:53:19
Subject: Re: Concurrent CREATE TABLE/DROP SCHEMA leaves inconsistent leftovers
Previous:From: Martin PihlakDate: 2012-01-16 13:23:09
Subject: Re: Generate call graphs in run-time

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group