]> granicus.if.org Git - postgresql/commitdiff
Stop table sync workers when subscription relation entry is removed
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 9 Jun 2017 13:47:52 +0000 (09:47 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 12 Jun 2017 12:53:37 +0000 (08:53 -0400)
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 <sawada.mshk@gmail.com>
src/backend/commands/subscriptioncmds.c

index 49737a904207ed8c000e092ee9d95ee0b76b78bb..8ec8742480272c65f0101318cdacb44797b7939d 100644 (file)
@@ -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",