Skip to content

Commit b5f2f2a

Browse files
Minor changes to recovery pause behaviour.
Change location LOG message so it works each time we pause, not just for final pause. Ensure that we pause only if we are in Hot Standby and can connect to allow us to run resume function. This change supercedes the code to override parameter recoveryPauseAtTarget to false if not attempting to enter Hot Standby, which is now removed.
1 parent ba7d020 commit b5f2f2a

File tree

1 file changed

+12
-12
lines changed
  • src/backend/access/transam

1 file changed

+12
-12
lines changed

src/backend/access/transam/xlog.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5691,6 +5691,10 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
56915691
static void
56925692
recoveryPausesHere(void)
56935693
{
5694+
ereport(LOG,
5695+
(errmsg("recovery has paused"),
5696+
errhint("Execute pg_xlog_replay_resume() to continue.")));
5697+
56945698
while (RecoveryIsPaused())
56955699
{
56965700
pg_usleep(1000000L); /* 1000 ms */
@@ -6357,13 +6361,6 @@ StartupXLOG(void)
63576361
StandbyRecoverPreparedTransactions(false);
63586362
}
63596363
}
6360-
else
6361-
{
6362-
/*
6363-
* Must not pause unless we are going to enter Hot Standby.
6364-
*/
6365-
recoveryPauseAtTarget = false;
6366-
}
63676364

63686365
/* Initialize resource managers */
63696366
for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
@@ -6485,11 +6482,11 @@ StartupXLOG(void)
64856482
*/
64866483
if (recoveryStopsHere(record, &recoveryApply))
64876484
{
6488-
if (recoveryPauseAtTarget)
6485+
/*
6486+
* Pause only if users can connect to send a resume message
6487+
*/
6488+
if (recoveryPauseAtTarget && standbyState == STANDBY_SNAPSHOT_READY)
64896489
{
6490-
ereport(LOG,
6491-
(errmsg("recovery has paused"),
6492-
errhint("Execute pg_xlog_replay_resume() to continue.")));
64936490
SetRecoveryPause(true);
64946491
recoveryPausesHere();
64956492
}
@@ -6522,7 +6519,10 @@ StartupXLOG(void)
65226519
recoveryPause = xlogctl->recoveryPause;
65236520
SpinLockRelease(&xlogctl->info_lck);
65246521

6525-
if (recoveryPause)
6522+
/*
6523+
* Pause only if users can connect to send a resume message
6524+
*/
6525+
if (recoveryPause && standbyState == STANDBY_SNAPSHOT_READY)
65266526
recoveryPausesHere();
65276527

65286528
/*

0 commit comments

Comments
 (0)