summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2017-06-09 13:47:52 +0000
committerPeter Eisentraut2017-06-12 12:53:37 +0000
commitddd7b22b225ae41d16ceb218b387645cb9becfdc (patch)
tree7cb6883325edf9c7f05c8e9fb867f025d38d6476
parenteab86897bd8cbeb21ae8959ca9a095ce7cb663df (diff)
Stop table sync workers when subscription relation entry is removed
When a table sync worker is in waiting state and the subscription table entry is removed because of a concurrent subscription refresh, the worker could be left orphaned. To avoid that, explicitly stop the worker when the pg_subscription_rel entry is removed. Reported-by: Masahiko Sawada <[email protected]>
-rw-r--r--src/backend/commands/subscriptioncmds.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 49737a9042..8ec8742480 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -600,6 +600,8 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data)
RemoveSubscriptionRel(sub->oid, relid);
+ logicalrep_worker_stop(sub->oid, relid);
+
namespace = get_namespace_name(get_rel_namespace(relid));
ereport(NOTICE,
(errmsg("removed subscription for table %s.%s",