Re: Disable startup progress timeout during standby WAL replay

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Aidar Imamov <imamovaj22(at)gmail(dot)com>
Cc: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Disable startup progress timeout during standby WAL replay
Date: 2026-11-30 22:46:46
Message-ID: 1069a1ba-7022-419f-a384-63dc8366d945@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20/11/2026 08:43, Fujii Masao wrote:
> In 0002, I clarified the code comment and added a note explaining that
> a standby may report progress during initial crash recovery. The code
> change itself is unchanged from v1.

LGTM. My AI reviewer says it's incomplete though.
begin_startup_progress_phase() has the same early return:

if (log_startup_progress_interval == 0)
return;
disable_startup_progress_timeout();
enable_startup_progress_timeout();

On a non-standby (crash recovery or PITR), suppose the interval is
reloaded to 0 after ResetUnloggedRelations() has started the timer. That
can happen while the first ReadRecord() waits on restore_command for
example. When redo starts, begin_startup_progress_phase() returns early
and the old timer is left running. "redo in progress" messages then keep
coming even though the user turned the feature off. And more
importantly, their elapsed time is wrong, because we skipped resetting
startup_progress_phase_start_time.

To fix, remove the early return from begin_startup_progress_phase().
That's enough because enable_startup_progress_timeout() already checks
for log_startup_progress_interval == 0.

> While updating the patch, I found another minor issue.
> If log_startup_progress_interval is changed to zero during initial
> crash recovery, disable_startup_progress_timeout() skips stopping
> the active timer when the server enters standby mode, leaving it to
> fire unnecessarily.
>
> Attached 0001 fixes this by removing the setting check from
> the disable function. Since this is the minor issue, a master-only fix
> might be sufficient. OTOH, backpatching also seems reasonable since
> this is a bug. I'm currently leaning toward backpatching through v15.

LGTM.

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Manu 2026-11-30 22:53:26 Re: Allow progress tracking of sub-commands
Previous Message Sami Imseih 2026-11-30 22:42:19 Re: Fix relation statistics around transactional TRUNCATE