aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-01-08 23:06:03 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-01-08 23:31:01 +0200
commit0402f24413c3e70f796562cb5459f33af071b0cc (patch)
tree269bcc4b7aed883032eeb3f897b46c34245f1c93 /src/backend/access/transam/xlog.c
parente56430c620357a3150e84e7fff9cc494031042a5 (diff)
downloadpostgresql-0402f24413c3e70f796562cb5459f33af071b0cc.tar.gz
postgresql-0402f24413c3e70f796562cb5459f33af071b0cc.zip
Fix pause_at_recovery_target + recovery_target_inclusive combination.
If pause_at_recovery_target is set, recovery pauses *before* applying the target record, even if recovery_target_inclusive is set. If you then continue with pg_xlog_replay_resume(), it will apply the target record before ending recovery. In other words, if you log in while it's paused and verify that the database looks OK, ending recovery changes its state again, possibly destroying data that you were tring to salvage with PITR. Backpatch to 9.1, this has been broken since pause_at_recovery_target was added.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 720f18116e9..33778e56995 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6623,11 +6623,6 @@ StartupXLOG(void)
*/
if (recoveryStopsHere(record, &recoveryApply))
{
- if (recoveryPauseAtTarget)
- {
- SetRecoveryPause(true);
- recoveryPausesHere();
- }
reachedStopPoint = true; /* see below */
recoveryContinue = false;
@@ -6697,6 +6692,12 @@ StartupXLOG(void)
* end of main redo apply loop
*/
+ if (recoveryPauseAtTarget && reachedStopPoint)
+ {
+ SetRecoveryPause(true);
+ recoveryPausesHere();
+ }
+
ereport(LOG,
(errmsg("redo done at %X/%X",
ReadRecPtr.xlogid, ReadRecPtr.xrecoff)));