Skip to content

Commit ddd7b22

Browse files
committed
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 <sawada.mshk@gmail.com>
1 parent eab8689 commit ddd7b22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data)
600600

601601
RemoveSubscriptionRel(sub->oid, relid);
602602

603+
logicalrep_worker_stop(sub->oid, relid);
604+
603605
namespace = get_namespace_name(get_rel_namespace(relid));
604606
ereport(NOTICE,
605607
(errmsg("removed subscription for table %s.%s",

0 commit comments

Comments
 (0)