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

Streaming replication and pg_xlogfile_name()

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Subject: Streaming replication and pg_xlogfile_name()
Date: 2010-01-19 09:35:06
Message-ID: 3f0b79eb1001190135vd9f62f1sa7868abc1ea61d12@mail.gmail.com (view raw or flat)
Thread:
Lists: 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, the current 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

Responses

pgsql-hackers by date

Next:From: Joachim WielandDate: 2010-01-19 09:58:33
Subject: Re: Listen / Notify - what to do when the queue is full
Previous:From: Dean RasheedDate: 2010-01-19 09:33:30
Subject: Re: Fixing handling of constraint triggers

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