Skip to content

Commit d8b23cd

Browse files
MasaoFujiihackorum
authored andcommitted
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.
1 parent 1f3b9bb commit d8b23cd

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

doc/src/sgml/config.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7661,7 +7661,9 @@ local0.* /var/log/postgresql
76617661
operation. The default is 10 seconds. A setting of <literal>0</literal>
76627662
disables the feature. If this value is specified without units,
76637663
it is taken as milliseconds. This setting is applied separately to
7664-
each operation.
7664+
each operation, such as WAL replay, syncing the data
7665+
directory, and resetting unlogged relations. On a standby server,
7666+
however, it does not apply during WAL replay.
76657667
This parameter can only be set in the <filename>postgresql.conf</filename>
76667668
file or on the server command line.
76677669
</para>

src/backend/access/transam/xlogrecovery.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,18 @@ PerformWalRecovery(void)
16691669
*/
16701670
CheckRecoveryConsistency();
16711671

1672+
/*
1673+
* EnableStandbyMode() disables periodic recovery progress logging,
1674+
* because a standby remains in recovery until promotion and would
1675+
* otherwise emit recovery progress messages indefinitely.
1676+
*
1677+
* However, earlier startup phases executed afterward, such as
1678+
* ResetUnloggedRelations(), may have re-enabled the timeout. Therefore,
1679+
* disable it again before entering WAL replay.
1680+
*/
1681+
if (StandbyMode)
1682+
disable_startup_progress_timeout();
1683+
16721684
/*
16731685
* Find the first record that logically follows the checkpoint --- it
16741686
* might physically precede it, though.

0 commit comments

Comments
 (0)