Hello,
Currently, DROP SUBSCRIPTION on REL_10_STABLE would block forever in the
following setup:
node 1:
create table t (i int);
create publication p for table t;
node 2:
create table t (i int);
create subscription s CONNECTION 'port=5432' publication p;
begin;
alter subscription s disable ;
alter subscription s set (slot_name = none);
drop subscription s;
end;
It hangs in replorigin_drop because we wait until ReplicationState is
released. This should happen on exit of worker, but worker will not exit
until transaction commit because he doesn't see that the sub was
disabled.
Attached patch fixes this by stopping workers before RO drop, as
already done in case when we drop replication slot. I am not sure
whether this is a proper solution, but for now I don't see any problems
with early stop of workers: even if transaction later aborts, launcher
will happily restart them, isn't it?
--
Arseny Sher
Postgres Professional: https://postgrespro.ru
The Russian Postgres Company