Streaming replication and pg_xlogfile_name() - Mailing list pgsql-hackers

From Fujii Masao
Subject Streaming replication and pg_xlogfile_name()
Date
Msg-id 3f0b79eb1001190135vd9f62f1sa7868abc1ea61d12@mail.gmail.com
Whole thread Raw
Responses Re: Streaming replication and pg_xlogfile_name()
List pgsql-hackers
Hi,

In relation to the functions added recently, I found an annoying problem;
pg_xlogfile_name(pg_last_xlog_receive/replay_location()) might report the
wrong name because pg_xlogfile_name() always uses the current timeline,
and a backend doesn't know the actual timeline related to the location
which pg_last_xlog_receive/replay_location() reports. Even if a backend
knows that, pg_xlogfile_name() would be unable to determine which timeline
should be used.

To solve this problem, I'm thiking to add the following functions:

* pg_current_timeline() reports the current timeline ID.
* pg_last_receive_timeline() reports the timeline ID which is related  to the last WAL receive location.
* pg_last_replay_timeline() reports the timeline ID which is related  to the last WAL replay location.
* pg_xlogfile_name(location text [, timeline bigint ]) reports the WAL  file name using the given timeline. By default,
thecurrent timeline  is used.
 
* pg_xlogfile_name_offset(location text [, timeline bigint]) reports  the WAL file name and offset using the given
timeline.By default,  the current timeline is used.
 

If the second parameter is omitted, pg_xlogfile_name() would behave
as it does now. We can get the right WAL file name by giving it the
result of pg_last_receive/replay_timeline().

Thought? Or we should just drop the support of pg_xlogfile_name()
for pg_last_xlog_receive/replay_locadtion()?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Fixing handling of constraint triggers
Next
From: Joachim Wieland
Date:
Subject: Re: Listen / Notify - what to do when the queue is full