Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpNZc-0001Qj-Cy for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 23:48:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dpNZb-0002c3-Vg for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Sep 2017 23:48:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dosZ7-00051P-Eh for pgsql-hackers@postgresql.org; Mon, 04 Sep 2017 14:41:29 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dosYy-0005qG-Rd for pgsql-hackers@postgresql.org; Mon, 04 Sep 2017 14:41:28 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4ACF721C1694 for ; Mon, 4 Sep 2017 17:41:20 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from ars-thinkpad (unknown [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 0B5A821C0552 for ; Mon, 4 Sep 2017 17:41:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1504536080; bh=SJ5FoRZB6e1NrnNnxPa/wHdw4aUz+u9Kbiedxw96vW4=; h=From:To:Subject:Date; b=Aupj8gly0+1Sa9ByB2q/aqRHTFW9J8kxbcvkU9X2tKv8oJnlvy1M12JDjZs3/hbta 6dieelayi7DrUny8Sigod++IOxEymnKqJQMoXGYSVBP+ZWtK33qD51FBnY3LlYM6Nc PyBUOXgb37sZVPkK86ipzPNuo2qcnvMxaIZhp2N0= From: Arseny Sher To: pgsql-hackers@postgresql.org Subject: DROP SUBSCRIPTION hangs if sub is disabled in the same transaction Date: Mon, 04 Sep 2017 17:41:19 +0300 Message-ID: <87mv6av84w.fsf@ars-thinkpad> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers