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

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: johnhyvr(at)gmail(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Kirill Reshke <reshkekirill(at)gmail(dot)com>
Subject: Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion
Date: 2025-11-05 04:33:52
Message-ID: CAHGQGwFP8i6s0+Xivmvtf-LS-DkJb-znzYZpi8NzWCqzLxK-+g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 1, 2025 at 3:14 AM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> Many storages charge for request. If archive tool issues HEAD request to S3 - it might costs user some money.
> Other storages cap frequency of requests at some RPS. In worst case we might affect archiving capabilities of primary.
>
> The key idea here is that archive storage might be a disaster recovery system that is optimized for storing data, but not for listing this data frequently. So the cluster should not delegate archive_status function to some distant storage if it can be cheaply tracked within HA cluster internally.

Just idea, as another approach, we could check whether the specified WAL file
has already been archived, by querying pg_stat_archiver on the primary,
instead of sending a request to the storage service. So, it seems we could set
the standby's archive_command to a script that performs this check
via pg_stat_archiver to achieve the same goal. Thoughts?

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shubham Khanna 2025-11-05 04:41:47 Re: Add support for specifying tables in pg_createsubscriber.
Previous Message Alexander Lakhin 2025-11-05 04:00:00 Re: Teaching planner to short-circuit empty UNION/EXCEPT/INTERSECT inputs