diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2011-03-23 19:35:53 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2011-03-23 19:35:53 +0000 |
commit | b5f2f2a712e56fe1edf7d5665c07ee97be464c0b (patch) | |
tree | 46bf4f8c4ffdc2779fc1fa4de1c70498a8c5a096 /src/backend/access/transam/xlog.c | |
parent | ba7d020d9d6edba872173f8640ca240e00ae7070 (diff) | |
download | postgresql-b5f2f2a712e56fe1edf7d5665c07ee97be464c0b.tar.gz postgresql-b5f2f2a712e56fe1edf7d5665c07ee97be464c0b.zip |
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.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 5a585f60d0b..418054066d1 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5691,6 +5691,10 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis) static void recoveryPausesHere(void) { + ereport(LOG, + (errmsg("recovery has paused"), + errhint("Execute pg_xlog_replay_resume() to continue."))); + while (RecoveryIsPaused()) { pg_usleep(1000000L); /* 1000 ms */ @@ -6357,13 +6361,6 @@ StartupXLOG(void) StandbyRecoverPreparedTransactions(false); } } - else - { - /* - * Must not pause unless we are going to enter Hot Standby. - */ - recoveryPauseAtTarget = false; - } /* Initialize resource managers */ for (rmid = 0; rmid <= RM_MAX_ID; rmid++) @@ -6485,11 +6482,11 @@ StartupXLOG(void) */ if (recoveryStopsHere(record, &recoveryApply)) { - if (recoveryPauseAtTarget) + /* + * Pause only if users can connect to send a resume message + */ + if (recoveryPauseAtTarget && standbyState == STANDBY_SNAPSHOT_READY) { - ereport(LOG, - (errmsg("recovery has paused"), - errhint("Execute pg_xlog_replay_resume() to continue."))); SetRecoveryPause(true); recoveryPausesHere(); } @@ -6522,7 +6519,10 @@ StartupXLOG(void) recoveryPause = xlogctl->recoveryPause; SpinLockRelease(&xlogctl->info_lck); - if (recoveryPause) + /* + * Pause only if users can connect to send a resume message + */ + if (recoveryPause && standbyState == STANDBY_SNAPSHOT_READY) recoveryPausesHere(); /* |