From: | SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Proposal: GUC to control starting/stopping logical subscription workers |
Date: | 2025-08-13 03:40:35 |
Message-ID: | CAHg+QDfFrD9Y_+ab56OHxk5y=792muMKZj7poshz8xuaRfTGJw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
I couldn't find a previous discussion on a new GUC to globally enable or
disable logical subscription workers at the instance level. So starting a
new thread on this.
In multi-region or high-availability setups, a promoted standby often
requires a controlled switchover before it should start applying logical
replication changes from upstream. Without such control, a promoted standby
may immediately attempt to connect to the publisher as a logical
subscriber, which can cause it to unexpectedly take over replication slots,
start pulling changes before the setup is ready, or even conflict with the
original primary that is still using those slots. Disabling the
subscription on the primary before promoting a standby is not possible in
all cases, for example during PITR or data center outages.
Providing a way to keep logical subscriptions globally disabled—via a GUC
setting—prior to promotion ensures that no changes are accidentally pulled
or applied before the system is fully prepared. This avoids race conditions
and the risk of data divergence.
I would like to propose adding a GUC with the following behavior:
1. Default value for the GUC is ON, same behavior as now without the GUC
2. When off, no new apply workers start and existing ones exit
gracefully similar to when subscription disabled
3. When turned on again, behavior will be the same as the current
behavior
4. This GUC shouldn't require a restart
Attaching a draft patch. Please let me know your thoughts.
Thanks,
Satya
Attachment | Content-Type | Size |
---|---|---|
v1_guc_logical_replication_subscriptions.patch | application/octet-stream | 5.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-08-13 03:54:27 | Re: Annoying warning in SerializeClientConnectionInfo |
Previous Message | Bertrand Drouvot | 2025-08-13 03:20:26 | Re: Adding locks statistics |