Skip to content

Commit 494e0c7

Browse files
lubennikovaavMatthias van de Meent
authored andcommitted
Skip dropping tablesync replication slots on the publisher (#594)
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 70e4c20 commit 494e0c7

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
@@ -1882,7 +1882,17 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
18821882

18831883
ReplicationSlotNameForTablesync(subid, relid, syncslotname,
18841884
sizeof(syncslotname));
1885-
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1885+
1886+
if (disable_logical_replication_subscribers)
1887+
{
1888+
ereport(LOG,
1889+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1890+
errmsg("skip dropping tablesync slot \"%s\" when disable_logical_replication_subscribers=true", syncslotname)));
1891+
}
1892+
else
1893+
{
1894+
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1895+
}
18861896
}
18871897
}
18881898

0 commit comments

Comments
 (0)