From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Pausing at recovery target is off by one
Date: Wed, 08 Jan 2014 22:53:34 +0200
Message-ID: <52CDBACE.2080204@vmware.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
pause_at_recovery_target doesn't do what I would expect when
recovery_target_inclusive='true' (which is the default). It pauses
before applying the target record, but if you then call
pg_xlog_replay_resume() to bring the system up, it will apply that one
more record, before exiting recovery. For example, if you do this in the
master:
insert into foo values (5);
Then crawl the WAL with pg_xlogdump to find the XID of that transaction,
and set recovery target to that:
recovery_target_xid='213890'
recovery_target_inclusive='true'
pause_at_recovery_target='true'
Now you connect to the paused system and verify that the state looks OK,
and call pg_xlog_replay(). Oops, the state it recovers to is not what
you expected:
postgres=# select ctid,* from foo;
ctid | i
-------+---
(0,1) | 1
(0,2) | 2
(0,3) | 3
(0,4) | 4
(4 rows)
postgres=# select pg_xlog_replay_resume();
pg_xlog_replay_resume
-----------------------
(1 row)
postgres=# select ctid,* from foo;
ctid | i
-------+---
(0,1) | 1
(0,2) | 2
(0,3) | 3
(0,4) | 4
(0,5) | 5
(5 rows)
I think this is a bug, and needs to be fixed.
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: hlinnakangas@vmware.com
Subject: Re: Pausing at recovery target is off by one
In-Reply-To: <52CDBACE.2080204@vmware.com>
References: <52CDBACE.2080204@vmware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox