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

Re: timestamp of the last replayed transaction

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: timestamp of the last replayed transaction
Date: 2010-11-06 00:58:31
Message-ID: AANLkTin-Tp6hfhQyWuoUvVWfw1Pb-yOf6=KYz6Bhr4-s@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Thu, Nov 4, 2010 at 9:00 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Thu, Nov 4, 2010 at 10:27 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> On Tue, Nov 2, 2010 at 10:38 PM, Dimitri Fontaine
>> <dimitri(at)2ndquadrant(dot)fr> wrote:
>>> Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
>>>> After 9.0 release, I've often heard that some people want to know
>>>> how far transactions have been replayed in the standby in timestamp
>>>> rather than LSN. So I'm thinking to include the function which returns
>>>> the timestamp of the last applied transaction (i.e., commit/abort WAL
>>>> record) in the core.
>>>>
>>>> Name: pg_last_replay_xact_timestamp (better name?)
>>>> Return Type: timestamp with time zone
>>>>
>>>> Thought?
>>>
>>> How do you want to implement the tracking?
>>
>> I'm thinking to just expose GetLatestXTime(), i.e., XLogCtl->recoveryLastXTime.
>
> I attached the patch.

This looks good, but how about adding:

if (!RecoveryInProgress())
    PG_RETURN_NULL();

Otherwise, if we're in Hot Standby mode for a while and then enter
normal running, wouldn't this still return a (stale) value?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-11-06 01:01:50
Subject: Re: temporary functions (and other object types)
Previous:From: Robert HaasDate: 2010-11-06 00:39:04
Subject: Re: How can we tell how far behind the standby is?

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