public inbox for [email protected]
help / color / mirror / Atom feedFrom: Yugo Nagata <[email protected]>
To: Pgsql Hackers <[email protected]>
Subject: Warn when creating or enabling a subscription with max_logical_replication_workers = 0
Date: Wed, 4 Feb 2026 14:07:31 +0900
Message-ID: <[email protected]> (raw)
Hi,
I would like to propose emitting a warning when creating or enabling a
subscription while max_logical_replication_workers is set to 0. In this
case, the CREATE/ALTER SUBSCRIPTION command completes successfully without
any warning, making it difficult to notice that logical replication cannot
start.
Of course, users can confirm whether logical replication is working by
checking system views such as pg_stat_replication or pg_stat_subscription.
However, emitting warnings explicitly in these cases would make this
situation more visible. We have seen user reports where this behavior
caused confusion, with users wondering why replication did not start.
I've attached a patch to address this.
Regards,
Yugo Nagata
--
Yugo Nagata <[email protected]>
Attachments:
[text/x-diff] 0001-Warn-when-creating-or-enabling-a-subscription-with-l.patch (1.9K, 2-0001-Warn-when-creating-or-enabling-a-subscription-with-l.patch)
download | inline diff:
From 6e59f4bd435b7e34837559c952f6b04475b43b09 Mon Sep 17 00:00:00 2001
From: Yugo Nagata <[email protected]>
Date: Sun, 1 Feb 2026 23:09:46 +0900
Subject: [PATCH] Warn when creating or enabling a subscription with logical
replication disabled
If max_logical_replication_workers is zero, logical replication is
disabled and will never start, even if a subscription is created or
enabled. Previously, these commands completed successfully without any
warning, making it difficult to notice that logical replication could
not start.
Emit warnings in these cases to make this situation more visible.
---
src/backend/commands/subscriptioncmds.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 0b3c8499b49..55ba4bfb53e 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -906,7 +906,14 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
* conflict during replication.
*/
if (opts.enabled || opts.retaindeadtuples)
+ {
+ if (max_logical_replication_workers == 0)
+ ereport(WARNING,
+ (errmsg("subscription was created, but logical replication is disabled"),
+ errhint("To initiate replication, set \"max_logical_replication_workers\" to a non zero value.")));
+
ApplyLauncherWakeupAtCommit();
+ }
ObjectAddressSet(myself, SubscriptionRelationId, subid);
@@ -1694,7 +1701,14 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
replaces[Anum_pg_subscription_subenabled - 1] = true;
if (opts.enabled)
+ {
+ if (max_logical_replication_workers == 0)
+ ereport(WARNING,
+ (errmsg("subscription was enabled, but logical replication is disabled"),
+ errhint("To initiate replication, set \"max_logical_replication_workers\" to a non zero value.")));
+
ApplyLauncherWakeupAtCommit();
+ }
update_tuple = true;
--
2.43.0
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Warn when creating or enabling a subscription with max_logical_replication_workers = 0
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox