Skip to content

Commit fb431df

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 fb431df

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/commands/subscriptioncmds.c

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

18101810
ReplicationSlotNameForTablesync(subid, relid, syncslotname,
18111811
sizeof(syncslotname));
1812-
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1812+
1813+
1814+
if (disable_logical_replication_subscribers)
1815+
{
1816+
ereport(LOG,
1817+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1818+
errmsg("do not drop tablesync slot \"%s\" when disable_logical_replication_subscribers=true", syncslotname)));
1819+
}
1820+
else
1821+
{
1822+
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1823+
}
18131824
}
18141825
}
18151826

0 commit comments

Comments
 (0)