Skip to content

Commit c032791

Browse files
lubennikovaavMMeent
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 a7a2f5a commit c032791

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

18811881
ReplicationSlotNameForTablesync(subid, relid, syncslotname,
18821882
sizeof(syncslotname));
1883-
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1883+
1884+
if (disable_logical_replication_subscribers)
1885+
{
1886+
ereport(LOG,
1887+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1888+
errmsg("skip dropping tablesync slot \"%s\" when disable_logical_replication_subscribers=true", syncslotname)));
1889+
}
1890+
else
1891+
{
1892+
ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
1893+
}
18841894
}
18851895
}
18861896

0 commit comments

Comments
 (0)