Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb023650

Browse files
committed
Improve the message logged when recovery is paused.
When recovery target is reached and recovery is paused because ofrecovery_target_action=pause, executing pg_wal_replay_resume() causesthe 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 causethe 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_pauseor recovery_target_action) causes recovery to be paused.Author: Sergei Kornilov, revised by Fujii MasaoReviewed-by: Robert HaasDiscussion:https://postgr.es/m/19168211580382043@myt5-b646bde4b8f3.qloud-c.yandex.net
1 parent051fd5e commitb023650

File tree

1 file changed

+17
-8
lines changed
  • src/backend/access/transam

1 file changed

+17
-8
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ static void validateRecoveryParameters(void);
885885
staticvoidexitArchiveRecovery(TimeLineIDendTLI,XLogRecPtrendOfLog);
886886
staticboolrecoveryStopsBefore(XLogReaderState*record);
887887
staticboolrecoveryStopsAfter(XLogReaderState*record);
888-
staticvoidrecoveryPausesHere(void);
888+
staticvoidrecoveryPausesHere(boolendOfRecovery);
889889
staticboolrecoveryApplyDelay(XLogReaderState*record);
890890
staticvoidSetLatestXTime(TimestampTzxtime);
891891
staticvoidSetCurrentChunkStartTime(TimestampTzxtime);
@@ -5951,12 +5951,16 @@ recoveryStopsAfter(XLogReaderState *record)
59515951
/*
59525952
* Wait until shared recoveryPause flag is cleared.
59535953
*
5954+
* endOfRecovery is true if the recovery target is reached and
5955+
* the paused state starts at the end of recovery because of
5956+
* recovery_target_action=pause, and false otherwise.
5957+
*
59545958
* XXX Could also be done with shared latch, avoiding the pg_usleep loop.
59555959
* Probably not worth the trouble though. This state shouldn't be one that
59565960
* anyone cares about server power consumption in.
59575961
*/
59585962
staticvoid
5959-
recoveryPausesHere(void)
5963+
recoveryPausesHere(boolendOfRecovery)
59605964
{
59615965
/* Don't pause unless users can connect! */
59625966
if (!LocalHotStandbyActive)
@@ -5966,9 +5970,14 @@ recoveryPausesHere(void)
59665970
if (LocalPromoteIsTriggered)
59675971
return;
59685972

5969-
ereport(LOG,
5970-
(errmsg("recovery has paused"),
5971-
errhint("Execute pg_wal_replay_resume() to continue.")));
5973+
if (endOfRecovery)
5974+
ereport(LOG,
5975+
(errmsg("pausing at the end of recovery"),
5976+
errhint("Execute pg_wal_replay_resume() to promote.")));
5977+
else
5978+
ereport(LOG,
5979+
(errmsg("recovery has paused"),
5980+
errhint("Execute pg_wal_replay_resume() to continue.")));
59725981

59735982
while (RecoveryIsPaused())
59745983
{
@@ -7201,7 +7210,7 @@ StartupXLOG(void)
72017210
* adding another spinlock cycle to prevent that.
72027211
*/
72037212
if (((volatileXLogCtlData*)XLogCtl)->recoveryPause)
7204-
recoveryPausesHere();
7213+
recoveryPausesHere(false);
72057214

72067215
/*
72077216
* Have we reached our recovery target?
@@ -7226,7 +7235,7 @@ StartupXLOG(void)
72267235
* work.
72277236
*/
72287237
if (((volatileXLogCtlData*)XLogCtl)->recoveryPause)
7229-
recoveryPausesHere();
7238+
recoveryPausesHere(false);
72307239
}
72317240

72327241
/* Setup error traceback support for ereport() */
@@ -7400,7 +7409,7 @@ StartupXLOG(void)
74007409

74017410
caseRECOVERY_TARGET_ACTION_PAUSE:
74027411
SetRecoveryPause(true);
7403-
recoveryPausesHere();
7412+
recoveryPausesHere(true);
74047413

74057414
/* drop into promote */
74067415

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp