Re: Let physical WAL senders restore missing segments from the archive

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Kirill Reshke <reshke(at)double(dot)cloud>
Subject: Re: Let physical WAL senders restore missing segments from the archive
Date: 2026-11-09 12:59:29
Message-ID: FA15B2F6-89EF-42AB-95C7-786F072D3A30@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Kirill,

Attached is v2. 0001 includes the fixes for old test senders and
multiple promotions that you reviewed. 0002 is your TIMELINE_HISTORY
addition.

On 24 Oct 2026, Kirill Reshke wrote:
> Can we use a single atomic integer?

Done. Physical and logical readers now also have separate open
callbacks, passing explicitly whether archive restoration is allowed.
The scratch filename is a local constant.

> Should we make this a GUC?

I'd keep the one-second delay fixed for now. It limits repeated
failures, including reconnects, while allowing concurrent restores. We
can add a setting if there is a use case for tuning it.

> I also didn't get why TAP test exercise cascading walsenders.

The middle standby uses its own restore_command after restartpoint
cleanup has removed the requested WAL. The downstream has no
restore_command. This checks archive fallback while the sender is in
recovery. Fetching missing WAL from upstream would be a separate
feature.

I think interruptible command execution should be shared by recovery,
archiving and the other external-command callers. The non-blocking
archiver discussion [0] already raised processing interrupts during a
command. Walsender also needs to service keepalives and feedback while
waiting. I'd build that on common child-process handling. v2 still runs
restore_command synchronously.

Thanks!

Best regards, Andrey Borodin.

[0] https://www.postgresql.org/message-id/2382367.ElGaqSPkdT@aivenlaptop

Attachment Content-Type Size
v2-0001-Allow-physical-WAL-senders-to-restore-missing-seg.patch application/octet-stream 44.6 KB
v2-0002-Allow-TIMELINE_HISTORY-to-restore-history-from-th.patch application/octet-stream 14.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2026-11-09 13:08:19 Re: First draft of PG 19 release notes
Previous Message Bruce Momjian 2026-11-09 12:44:34 Re: First draft of PG 19 release notes