Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5Yb0-0004WJ-NA for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2017 14:16:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d5Yb0-0005bY-4l for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2017 14:16:06 +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 1d5YZS-0002Ck-9O for pgsql-hackers@postgresql.org; Tue, 02 May 2017 14:14:30 +0000 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d5YZO-0006do-Lw for pgsql-hackers@postgresql.org; Tue, 02 May 2017 14:14:29 +0000 Received: by mail-wr0-x22e.google.com with SMTP id l50so81710976wrc.3 for ; Tue, 02 May 2017 07:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=2Ig2QZV0ZZxRi4wBfFNUBrTwF0gRdgyndVl650erkSo=; b=ySZiu2h/NNrkiUGyP6VhZgB/ZZMdEuPckuqvFQi8hApO14R3V+94KQqruDKKx+tIvq bktCa8VVxwTjwhdIvAMpD7snG7nEW/0lnaIF3+TfeSMP6+6kYlMRMjjG/O+oEWXY7mzS 0Lxg7XmYVRd7TgE9Pl+RATxn0JyTW2XqNrtqdGwy37qoLA980XJlfGdQSzokQKxA/NoG u32UhYEZRiNqu5Uyt14DcjGyb0IgUK7IF4Yaq+eS6rRxQk18EMSrMPSJcIyR2+H6NbIk 8P/Fb583thujEwxoFrgxGo9VMTDx0f8mr7ReHoW1ShkdmvFjsCCnMec+PXwVhhUX3Dh5 LyOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=2Ig2QZV0ZZxRi4wBfFNUBrTwF0gRdgyndVl650erkSo=; b=kNJcIp+X6cEFjqNF+uRSJg6HdkaE2AL3MgiRlW3BZfOPUwNp3c6iPdFHLXog6kRdpZ WvAL+6Dq64I3nCuBUJKaTsd6RrBzyIzkqJAHHdC1gPPYHjH/h0wT2mOj2Xgh0SmK04pB N0wJGOkqipnN5iLQllsD7uVFCU2MAW54YKZnsjccbgDZEalSZ2jwDV+qa3VnHHkvu7RU u4+s6q4/CzcP9m+vNO2xyH8OHpqY9y3cLjtSR5Zb92pIQ3v/vfj89phr0jk+cphAcxUm UZcZ27MHni+QgHlVMXLe7o8WFip3WkQBh9iulyySkY76Z5st7isgAdSl4E49xE+YZkBf a66w== X-Gm-Message-State: AN3rC/7sX3NlYiLcLySh+HH/+uPURGtZoeUl1eb5qeEmM6W6qJC4ujLZ IeiOFF7ygjspoTaT9mbH0Fe3+4mJYlj2C0zj8jiUJlPYxbn8syBWvCidYSCFcajIgseNu50DdMJ 1zGy7qmNX7pUGfIEQ9IeQ3ijtenyy7MyBBdVQgpCW+D6ZqR5w9hy/F3/cAYbG/o/gL8IguQSK X-Received: by 10.223.172.105 with SMTP id v96mr22037881wrc.1.1493734465306; Tue, 02 May 2017 07:14:25 -0700 (PDT) Received: from [192.168.0.105] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id q19sm2690289wmd.1.2017.05.02.07.14.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 07:14:24 -0700 (PDT) Subject: Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling) To: Tom Lane References: <27478.1493727233@sss.pgh.pa.us> <29431.1493730652@sss.pgh.pa.us> <360a1932-7af4-609b-94f1-2ad419430869@2ndquadrant.com> <9174dc31-787a-a2f6-818f-cb4a5c1dfddb@2ndquadrant.com> <30166.1493731904@sss.pgh.pa.us> Cc: Robert Haas , Michael Paquier , PostgreSQL mailing lists From: Petr Jelinek Message-ID: Date: Tue, 2 May 2017 16:14:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <30166.1493731904@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) 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 On 02/05/17 15:31, Tom Lane wrote: > Petr Jelinek writes: >> Let me expand, if we don't drop the slot by default when dropping >> subscription, we'll have a lot of users with dead slots laying around >> holding back WAL/catalog_xmin, that's really bad. If we do drop by >> default like now, we need option to not do that, neither RESTRICT, nor >> CASCADE fit that. > > I'm not sure which part of "you can't have an option in DROP" isn't > clear to you. Whatever the default behavior is always has to work, > because that is what's going to happen during DROP OWNED BY, or > DROP DATABASE. You are saying it like there was some guarantee that those commands can't fail because of other objects. AFAIK for example drop database can trivially fail just because there is replication slot in it before PG10 (IIRC Craig managed to fix that in 10 for unrelated reasons). > If you want more than one behavior during DROP, > you need to drive that off something represented as a persistent > property of the object, not off an option in the DROP command. > I don't see how changing behavior as object property will change anything in terms of not failing to cascade. If you use CREATE or ALTER to say that subscription must drop slot and that fails then the cascade will still fail so then you need to run ALTER again to change that property. I fail to see how that's easier than running the DROP directly. So the only way to fulfill the requirement you stated is to just not try to drop the slot, ever, on DROP SUBSCRIPTION. That makes the default behavior leave resources on upstream that will eventually cause that server to stop unless user notices before. I think we better invent something that limits how much inactive slots can hold back WAL and catalog_xmin in this release as well then. We should also not create the slot (at least by default) on CREATE SUBSCRIPTION to have some symmetry. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers