Skip to content

Commit 915f245

Browse files
committed
Do not drop tablesync replication slots on the publisher
when we're in the process of dropping subscriptions inherited by a neon branch. Because these slots are still needed by the parent branch subscriptions. For regular slots we handle this by setting the slot_name to NONE before calling DROP SUBSCRIPTION, but tablesync slots are not exposed to SQL. rely on GUC disable_logical_replication_subscribers=true to know that we're in the Neon-specific process of dropping subscriptions.
1 parent 517b8dc commit 915f245

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,17 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
18091809

18101810
ReplicationSlotNameForTablesync(subid, relid, syncslotname,
18111811
sizeof(syncslotname));
1812-
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1812+
1813+
if (disable_logical_replication_subscribers)
1814+
{
1815+
ereport(LOG,
1816+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1817+
errmsg("skip dropping tablesync slot \"%s\" when disable_logical_replication_subscribers=true", syncslotname)));
1818+
}
1819+
else
1820+
{
1821+
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1822+
}
18131823
}
18141824
}
18151825

0 commit comments

Comments
 (0)