pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix DROP SUBSCRIPTION hang
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix DROP SUBSCRIPTION hang
@ 2017-09-18 02:33  Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2017-09-18 02:33 UTC (permalink / raw)
  To: pgsql-committers

Fix DROP SUBSCRIPTION hang

When ALTER SUBSCRIPTION DISABLE is run in the same transaction before
DROP SUBSCRIPTION, the latter will hang because workers will still be
running, not having seen the DISABLE committed, and DROP SUBSCRIPTION
will wait until the workers have vacated the replication origin slots.

Previously, DROP SUBSCRIPTION killed the logical replication workers
immediately only if it was going to drop the replication slot, otherwise
it scheduled the worker killing for the end of the transaction, as a
result of 7e174fa793a2df89fe03d002a5087ef67abcdde8.  This, however,
causes the present problem.  To fix, kill the workers immediately in all
cases.  This covers all cases: A subscription that doesn't have a
replication slot must be disabled.  It was either disabled in the same
transaction, or it was already disabled before the current transaction,
but then there shouldn't be any workers left and this won't make a
difference.

Reported-by: Arseny Sher <a.sher@postgrespro.ru>
Discussion: https://www.postgresql.org/message-id/flat/87mv6av84w.fsf%40ars-thinkpad

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8edacab209957520423770851351ab4013cb0167

Modified Files
--------------
src/backend/commands/subscriptioncmds.c | 19 +++++++-----
src/test/subscription/t/007_ddl.pl      | 51 +++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 7 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix DROP SUBSCRIPTION hang
@ 2017-09-18 02:33  Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2017-09-18 02:33 UTC (permalink / raw)
  To: pgsql-committers

Fix DROP SUBSCRIPTION hang

When ALTER SUBSCRIPTION DISABLE is run in the same transaction before
DROP SUBSCRIPTION, the latter will hang because workers will still be
running, not having seen the DISABLE committed, and DROP SUBSCRIPTION
will wait until the workers have vacated the replication origin slots.

Previously, DROP SUBSCRIPTION killed the logical replication workers
immediately only if it was going to drop the replication slot, otherwise
it scheduled the worker killing for the end of the transaction, as a
result of 7e174fa793a2df89fe03d002a5087ef67abcdde8.  This, however,
causes the present problem.  To fix, kill the workers immediately in all
cases.  This covers all cases: A subscription that doesn't have a
replication slot must be disabled.  It was either disabled in the same
transaction, or it was already disabled before the current transaction,
but then there shouldn't be any workers left and this won't make a
difference.

Reported-by: Arseny Sher <a.sher@postgrespro.ru>
Discussion: https://www.postgresql.org/message-id/flat/87mv6av84w.fsf%40ars-thinkpad

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/522b028a0000d08c6d113c2334e669dd31a6b1cd

Modified Files
--------------
src/backend/commands/subscriptioncmds.c | 19 +++++++-----
src/test/subscription/t/007_ddl.pl      | 51 +++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 7 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-09-18 02:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 02:33 pgsql: Fix DROP SUBSCRIPTION hang Peter Eisentraut <peter_e@gmx.net>
2017-09-18 02:33 pgsql: Fix DROP SUBSCRIPTION hang Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox