From d490ca81fdb6e110dd1992aa754a82947dfdf0fe Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Thu, 11 Jun 2026 08:28:12 +0900 Subject: [PATCH v1] Disable startup progress timeout during standby WAL replay The server disables periodic recovery progress logging controlled by log_startup_progress_interval in standby mode, because a standby remains in recovery until promotion and would otherwise emit recovery progress messages indefinitely. However, startup operations executed afterward, such as ResetUnloggedRelations(), can re-enable the startup progress timeout. As a result, the timeout could previously remain active during standby WAL replay. This caused no user-visible issue because recovery progress messages are not emitted during standby WAL replay. However, the timeout still generated unnecessary periodic wakeups. Fix this by disabling the startup progress timeout again when WAL replay starts in standby mode. This preserves progress reporting for earlier startup operations while keeping the timeout disabled during standby WAL replay as intended. Also clarify the log_startup_progress_interval documentation to describe which startup operations emit progress messages, and that WAL replay progress is not reported on standby servers. --- doc/src/sgml/config.sgml | 4 +++- src/backend/access/transam/xlogrecovery.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index fa566c9e553..b1141fc74da 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7637,7 +7637,9 @@ local0.* /var/log/postgresql operation. The default is 10 seconds. A setting of 0 disables the feature. If this value is specified without units, it is taken as milliseconds. This setting is applied separately to - each operation. + each operation, such as WAL replay, syncing the data + directory, and resetting unlogged relations. On a standby server, + however, it does not apply during WAL replay. This parameter can only be set in the postgresql.conf file or on the server command line. diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index 73b78a83fa7..c89d6ec30a3 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -1655,6 +1655,18 @@ PerformWalRecovery(void) */ CheckRecoveryConsistency(); + /* + * EnableStandbyMode() disables periodic recovery progress logging, + * because a standby remains in recovery until promotion and would + * otherwise emit recovery progress messages indefinitely. + * + * However, earlier startup phases executed afterward, such as + * ResetUnloggedRelations(), may have re-enabled the timeout. Therefore, + * disable it again before entering WAL replay. + */ + if (StandbyMode) + disable_startup_progress_timeout(); + /* * Find the first record that logically follows the checkpoint --- it * might physically precede it, though. -- 2.53.0