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: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: age(xid) on hot standby
Date: 2011-12-28 18:24:02
Message-ID: 1325096414-sup-3427@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Peter Eisentraut's message of mié dic 28 15:04:09 -0300 2011:
> The check_postgres txn_wraparound action[0] runs this query:
> 
>    SELECT datname, age(datfrozenxid) AS age FROM pg_database WHERE datallowconn ORDER BY 1, 2
> 
> On a hot standby, this fails with:
> 
>    ERROR:  cannot assign TransactionIds during recovery
> 
> So, a couple of things to wonder about:
> 
> Is it unreasonable to check for transaction ID wraparound on a standby?
> It should mirror the situation on the primary, shouldn't it?
> 
> Should the age(xid) function do something more useful on a standby,
> e.g., have a custom error message or return null or use the transaction
> ID from the master?

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.

-- 
Á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: Tom LaneDate: 2011-12-28 19:35:34
Subject: Re: age(xid) on hot standby
Previous:From: Dimitri FontaineDate: 2011-12-28 18:12:48
Subject: Re: contrib/README

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