From 1f4ff2aa4f5241cf4cd824fdfd1d1d8cdd94fbb0 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 20 Nov 2026 11:11:38 +0900
Subject: [PATCH v3 1/2] Fix startup progress timeout cancellation after
 configuration reload

A server configured as a standby may initially perform crash recovery
before entering standby mode. If log_startup_progress_interval was
changed to zero during that crash recovery phase, the startup process
could continue waking up periodically after entering standby mode,
even though WAL replay progress was no longer reported.

This happened because disable_startup_progress_timeout() skipped
canceling the timeout when the setting was zero. Reloading the
configuration updated the setting but left an already-enabled timeout
running at its previous interval, so the zero value did not mean that
there was no timeout to cancel.

Fix this by removing the setting check from
disable_startup_progress_timeout(), so that it always cancels the
timeout and clears the progress flag.

Backpatch to 15, where startup progress reporting was introduced.
---
 src/backend/postmaster/startup.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c
index 63624e8caa1..ca6709b06fe 100644
--- a/src/backend/postmaster/startup.c
+++ b/src/backend/postmaster/startup.c
@@ -302,10 +302,6 @@ startup_progress_timeout_handler(void)
 void
 disable_startup_progress_timeout(void)
 {
-	/* Feature is disabled. */
-	if (log_startup_progress_interval == 0)
-		return;
-
 	disable_timeout(STARTUP_PROGRESS_TIMEOUT, false);
 	startup_progress_timer_expired = false;
 }
-- 
2.56.0

