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

Re: Streaming replication and pg_xlogfile_name()

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Erik Rijkers <er(at)xs4all(dot)nl>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Streaming replication and pg_xlogfile_name()
Date: 2010-03-03 14:03:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Mar 2, 2010 at 10:52 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> It's not clear what it should return, a TLI corresponding the filename
>> of the WAL segment the record was replayed from, so that you can use
>> pg_xlogfile_name() to find out the filename of the WAL segment being
>> replayed, or the accurate TLI of the record being replayed. I'm leaning
>> towards the latter, it feels more correct and accurate, but you could
>> argue for the former too. In any case, it needs to be well-defined.
> I agree with you that the latter is more correct and accurate. The simple
> fix is updating the lastPageTLI with the CheckPoint->ThisTimeLineID when
> replaying the shutdown checkpoint record. Though we might need to use new
> variable to keep the last applied timeline instead of the lastPageTLI.

Here is the revised patch. I used new local variable instead of lastPageTLI
to track the tli of last applied record. It is updated with the tli of the
log page header when reading the page, and with the tli of the checkpoint
record when replaying the checkpoint shutdown record that changes the tli.
So pg_last_xlog_replay_location() can return the accurate tli of the last
applied record.


Fujii Masao
NTT Open Source Software Center

Attachment: extend_format_of_recovery_info_funcs_v4.patch
Description: text/x-patch (13.9 KB)

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2010-03-03 14:25:29
Subject: Re: [GENERAL] to_timestamp() and quarters
Previous:From: Robert HaasDate: 2010-03-03 13:42:15
Subject: Re: renameatt() can rename attribute of index, sequence, ...

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