diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index cb07694aea..271a07498f 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -1645,17 +1645,20 @@ PerformWalRecovery(void) LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)))); /* Prepare to report progress of the redo phase. */ - if (!StandbyMode) - begin_startup_progress_phase(); + begin_startup_progress_phase(); /* * main redo apply loop */ do { - if (!StandbyMode) - ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%X", - LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)); + /* + * If StandbyMode = true, then this will not emit messages. If it + * is false now but becomes true later, this will stop emitting + * messages when it becomes true. + */ + ereport_startup_progress("redo in progress, elapsed time: %ld.%02d s, current LSN: %X/%X", + LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)); #ifdef WAL_DEBUG if (XLOG_DEBUG || diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c index f99186eab7..7c7be7694d 100644 --- a/src/backend/postmaster/startup.c +++ b/src/backend/postmaster/startup.c @@ -350,6 +350,19 @@ has_startup_progress_timeout_expired(long *secs, int *usecs) /* No timeout has occurred. */ if (!startup_progress_timer_expired) return false; + startup_progress_timer_expired = false; + + /* + * If we're in standby mode, we don't regard ourselves as still starting + * up, since standby mode is a state that is intendeded to persist + * indefinitely. So, in that case, don't log a message, and disable the + * timeout to prevent future wakeups. + */ + if (StandbyMode) + { + disable_timeout(STARTUP_PROGRESS_TIMEOUT, false); + return false; + } /* Calculate the elapsed time. */ now = GetCurrentTimestamp(); @@ -357,7 +370,6 @@ has_startup_progress_timeout_expired(long *secs, int *usecs) *secs = seconds; *usecs = useconds; - startup_progress_timer_expired = false; return true; }