mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Improve the message logged when recovery is paused.
When recovery target is reached and recovery is paused because of recovery_target_action=pause, executing pg_wal_replay_resume() causes the standby to promote, i.e., the recovery to end. So, in this case, the previous message "Execute pg_wal_replay_resume() to continue" logged was confusing because pg_wal_replay_resume() doesn't cause the recovery to continue. This commit improves the message logged when recovery is paused, and the proper message is output based on what (pg_wal_replay_pause or recovery_target_action) causes recovery to be paused. Author: Sergei Kornilov, revised by Fujii Masao Reviewed-by: Robert Haas Discussion: https://postgr.es/m/19168211580382043@myt5-b646bde4b8f3.qloud-c.yandex.net
This commit is contained in:
parent
051fd5e0f9
commit
b0236508d3
@ -885,7 +885,7 @@ static void validateRecoveryParameters(void);
|
|||||||
static void exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog);
|
static void exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog);
|
||||||
static bool recoveryStopsBefore(XLogReaderState *record);
|
static bool recoveryStopsBefore(XLogReaderState *record);
|
||||||
static bool recoveryStopsAfter(XLogReaderState *record);
|
static bool recoveryStopsAfter(XLogReaderState *record);
|
||||||
static void recoveryPausesHere(void);
|
static void recoveryPausesHere(bool endOfRecovery);
|
||||||
static bool recoveryApplyDelay(XLogReaderState *record);
|
static bool recoveryApplyDelay(XLogReaderState *record);
|
||||||
static void SetLatestXTime(TimestampTz xtime);
|
static void SetLatestXTime(TimestampTz xtime);
|
||||||
static void SetCurrentChunkStartTime(TimestampTz xtime);
|
static void SetCurrentChunkStartTime(TimestampTz xtime);
|
||||||
@ -5951,12 +5951,16 @@ recoveryStopsAfter(XLogReaderState *record)
|
|||||||
/*
|
/*
|
||||||
* Wait until shared recoveryPause flag is cleared.
|
* Wait until shared recoveryPause flag is cleared.
|
||||||
*
|
*
|
||||||
|
* endOfRecovery is true if the recovery target is reached and
|
||||||
|
* the paused state starts at the end of recovery because of
|
||||||
|
* recovery_target_action=pause, and false otherwise.
|
||||||
|
*
|
||||||
* XXX Could also be done with shared latch, avoiding the pg_usleep loop.
|
* XXX Could also be done with shared latch, avoiding the pg_usleep loop.
|
||||||
* Probably not worth the trouble though. This state shouldn't be one that
|
* Probably not worth the trouble though. This state shouldn't be one that
|
||||||
* anyone cares about server power consumption in.
|
* anyone cares about server power consumption in.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
recoveryPausesHere(void)
|
recoveryPausesHere(bool endOfRecovery)
|
||||||
{
|
{
|
||||||
/* Don't pause unless users can connect! */
|
/* Don't pause unless users can connect! */
|
||||||
if (!LocalHotStandbyActive)
|
if (!LocalHotStandbyActive)
|
||||||
@ -5966,9 +5970,14 @@ recoveryPausesHere(void)
|
|||||||
if (LocalPromoteIsTriggered)
|
if (LocalPromoteIsTriggered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ereport(LOG,
|
if (endOfRecovery)
|
||||||
(errmsg("recovery has paused"),
|
ereport(LOG,
|
||||||
errhint("Execute pg_wal_replay_resume() to continue.")));
|
(errmsg("pausing at the end of recovery"),
|
||||||
|
errhint("Execute pg_wal_replay_resume() to promote.")));
|
||||||
|
else
|
||||||
|
ereport(LOG,
|
||||||
|
(errmsg("recovery has paused"),
|
||||||
|
errhint("Execute pg_wal_replay_resume() to continue.")));
|
||||||
|
|
||||||
while (RecoveryIsPaused())
|
while (RecoveryIsPaused())
|
||||||
{
|
{
|
||||||
@ -7201,7 +7210,7 @@ StartupXLOG(void)
|
|||||||
* adding another spinlock cycle to prevent that.
|
* adding another spinlock cycle to prevent that.
|
||||||
*/
|
*/
|
||||||
if (((volatile XLogCtlData *) XLogCtl)->recoveryPause)
|
if (((volatile XLogCtlData *) XLogCtl)->recoveryPause)
|
||||||
recoveryPausesHere();
|
recoveryPausesHere(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Have we reached our recovery target?
|
* Have we reached our recovery target?
|
||||||
@ -7226,7 +7235,7 @@ StartupXLOG(void)
|
|||||||
* work.
|
* work.
|
||||||
*/
|
*/
|
||||||
if (((volatile XLogCtlData *) XLogCtl)->recoveryPause)
|
if (((volatile XLogCtlData *) XLogCtl)->recoveryPause)
|
||||||
recoveryPausesHere();
|
recoveryPausesHere(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup error traceback support for ereport() */
|
/* Setup error traceback support for ereport() */
|
||||||
@ -7400,7 +7409,7 @@ StartupXLOG(void)
|
|||||||
|
|
||||||
case RECOVERY_TARGET_ACTION_PAUSE:
|
case RECOVERY_TARGET_ACTION_PAUSE:
|
||||||
SetRecoveryPause(true);
|
SetRecoveryPause(true);
|
||||||
recoveryPausesHere();
|
recoveryPausesHere(true);
|
||||||
|
|
||||||
/* drop into promote */
|
/* drop into promote */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user