Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3aefff4

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 425bef6 commit 3aefff4

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
@@ -5574,11 +5574,6 @@ StartupXLOG(void)
55745574
*/
55755575
if (recoveryStopsHere(record, &recoveryApply))
55765576
{
5577-
if (recoveryPauseAtTarget)
5578-
{
5579-
SetRecoveryPause(true);
5580-
recoveryPausesHere();
5581-
}
55825577
reachedStopPoint = true; /* see below */
55835578
recoveryContinue = false;
55845579

@@ -5709,6 +5704,12 @@ StartupXLOG(void)
57095704
* end of main redo apply loop
57105705
*/
57115706

5707+
if (recoveryPauseAtTarget && reachedStopPoint)
5708+
{
5709+
SetRecoveryPause(true);
5710+
recoveryPausesHere();
5711+
}
5712+
57125713
ereport(LOG,
57135714
(errmsg("redo done at %X/%X",
57145715
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));

0 commit comments

Comments
 (0)