[HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the same transaction

Поиск
Список
Период
Сортировка
От Arseny Sher
Тема [HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the same transaction
Дата
Msg-id 87mv6av84w.fsf@ars-thinkpad
обсуждение исходный текст
Ответы Re: [HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the same transaction  (Arseny Sher <a.sher@postgrespro.ru>)
Re: [HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the sametransaction  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Release Note changes
Следующее
От: Arseny Sher
Дата:
Сообщение: Re: [HACKERS] DROP SUBSCRIPTION hangs if sub is disabled in the same transaction