Commit 3739e5ab authored by Heikki Linnakangas's avatar Heikki Linnakangas

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.
parent 815d71de
...@@ -6794,11 +6794,6 @@ StartupXLOG(void) ...@@ -6794,11 +6794,6 @@ StartupXLOG(void)
*/ */
if (recoveryStopsHere(record, &recoveryApply, &recoveryDelay)) if (recoveryStopsHere(record, &recoveryApply, &recoveryDelay))
{ {
if (recoveryPauseAtTarget)
{
SetRecoveryPause(true);
recoveryPausesHere();
}
reachedStopPoint = true; /* see below */ reachedStopPoint = true; /* see below */
recoveryContinue = false; recoveryContinue = false;
...@@ -6948,6 +6943,12 @@ StartupXLOG(void) ...@@ -6948,6 +6943,12 @@ StartupXLOG(void)
* end of main redo apply loop * end of main redo apply loop
*/ */
if (recoveryPauseAtTarget && reachedStopPoint)
{
SetRecoveryPause(true);
recoveryPausesHere();
}
ereport(LOG, ereport(LOG,
(errmsg("redo done at %X/%X", (errmsg("redo done at %X/%X",
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment