Skip to content

Commit 0402f24

Browse files
committed
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.
1 parent e56430c commit 0402f24

File tree

1 file changed

+6
-5
lines changed
  • src/backend/access/transam

1 file changed

+6
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6623,11 +6623,6 @@ StartupXLOG(void)
66236623
*/
66246624
if (recoveryStopsHere(record, &recoveryApply))
66256625
{
6626-
if (recoveryPauseAtTarget)
6627-
{
6628-
SetRecoveryPause(true);
6629-
recoveryPausesHere();
6630-
}
66316626
reachedStopPoint = true; /* see below */
66326627
recoveryContinue = false;
66336628

@@ -6697,6 +6692,12 @@ StartupXLOG(void)
66976692
* end of main redo apply loop
66986693
*/
66996694

6695+
if (recoveryPauseAtTarget && reachedStopPoint)
6696+
{
6697+
SetRecoveryPause(true);
6698+
recoveryPausesHere();
6699+
}
6700+
67006701
ereport(LOG,
67016702
(errmsg("redo done at %X/%X",
67026703
ReadRecPtr.xlogid, ReadRecPtr.xrecoff)));

0 commit comments

Comments
 (0)