Skip to content

Commit 3bd8987

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 82c75f9 commit 3bd8987

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
@@ -6868,11 +6868,6 @@ StartupXLOG(void)
68686868
*/
68696869
if (recoveryStopsHere(record, &recoveryApply))
68706870
{
6871-
if (recoveryPauseAtTarget)
6872-
{
6873-
SetRecoveryPause(true);
6874-
recoveryPausesHere();
6875-
}
68766871
reachedStopPoint = true; /* see below */
68776872
recoveryContinue = false;
68786873

@@ -6951,6 +6946,12 @@ StartupXLOG(void)
69516946
* end of main redo apply loop
69526947
*/
69536948

6949+
if (recoveryPauseAtTarget && reachedStopPoint)
6950+
{
6951+
SetRecoveryPause(true);
6952+
recoveryPausesHere();
6953+
}
6954+
69546955
ereport(LOG,
69556956
(errmsg("redo done at %X/%X",
69566957
ReadRecPtr.xlogid, ReadRecPtr.xrecoff)));

0 commit comments

Comments
 (0)