Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion

From: Roman Khapov <rkhapov(at)yandex-team(dot)ru>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion
Date: 2025-12-22 14:10:30
Message-ID: 2B425DAC-D16D-43FA-A7C5-BE88A2294967@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> On 23 Oct 2025, at 21:25, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> Hi hackers,
>
> I'd like to propose a new archive_mode setting to address a gap in WAL
> archiving for high availability streaming replication configurations.
>
> Best regards, Andrey Borodin.
> <v1-0001-Add-archive_mode-follow_primary-to-prevent-WAL-lo.patch>

Hi!

As discussed offline: there is one small part of your patch to improve - make
walsender send answer for every requested segments, not for the first 64
(still, walreceiver limits segments count to 64).

Also I noticed some improvement possibilities in test:

- repeat logic of polling for several conditions across the test archive_follow_primary.pl,
seems like we need some general polling functions in PostgreSQL::Test::Utils?
I added poll_until, poll_cmd_until functions for that, and use them now in the test
(and also in poll_query_until, that was my inspiration)

- there was some places that checks invariants that is always true:
done_files_appeared, standby2_done_found, standby3_done_found was checked for >= 0,
but initial value was 0, ready_files_found was polled but not verified, and also ready_count_after <= ready_count_before was not checked correctly (in case polling was break by ’timeout’), I replaced
all of them with more strictly checks, is that right, or I missed some points?

--
Best regards,
Roman Khapov

Attachment Content-Type Size
v2-0001-inproduce-general-polling-functions-for-TAP-tests.patch application/octet-stream 5.8 KB
v2-0002-Add-archive_mode-follow_primary-to-prevent-WAL-lo.patch application/octet-stream 32.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-12-22 14:10:34 Re: ditaa --svg option is missing when building doc/src/sgml/images
Previous Message Marcos Pegoraro 2025-12-22 13:28:43 Re: Get rid of "Section.N.N.N" on DOCs