age(xid) on hot standby

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: age(xid) on hot standby
Date: 2011-12-28 18:04:09
Message-ID: 1325095449.24752.4.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

The error message is coded as an elog() call, meaning that users
shouldn't see it, but it can evidently be triggered by a user, so maybe
we should decorate it with some detail, depending on the outcome of the
previous question.

(It looks like age(xid) isn't documented at all. Maybe it should be.)

[0] - http://bucardo.org/check_postgres/check_postgres.pl.html#txn_wraparound

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Crawford 2011-12-28 18:05:49 Re: pgstat wait timeout
Previous Message Heikki Linnakangas 2011-12-28 17:45:37 Re: 16-bit page checksums for 9.2