Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d80xY-00039B-Ry for pgsql-hackers@arkaria.postgresql.org; Tue, 09 May 2017 08:57:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d80xX-00017y-R7 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 May 2017 08:57:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d80xX-00017Y-1F for pgsql-hackers@postgresql.org; Tue, 09 May 2017 08:57:31 +0000 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d80xT-0008Gs-To for pgsql-hackers@postgresql.org; Tue, 09 May 2017 08:57:29 +0000 Received: by mail-wr0-x229.google.com with SMTP id z52so63950600wrc.2 for ; Tue, 09 May 2017 01:57:27 -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=uIV70OLO1UlDe0WGWVvP5BntLkj94bP8yACpwrRQpa8=; b=Pf+EtKs3AmhU+6k30ihnRXL+P4exlbFxrH1LcgNsy4uXjXr5YBgcGO2LZBxokjBk11 l+HE8la/oFRSsT7IT9zbGlZy2K676p6lLZ+5OuLcv+6lbJcitC4y50UEz8OOJCwn+Wat 3O+iskvbmCixmpki2PIj+o9l+2RPFaEBd/2+tSuBB0zjNy5Zk0MVGRrLuG9PGiK8TFyr RR0X/b4xInwXeOAxOm0MiCWvvK9Oc2UENw8zSigM+Rp51ZuOgrFwnowGsHUKl7YbJAYv LNvI2OTbeI3e7SF0gB/HffIur/fkab1gogPlC8zGr0GaHymaWKc2MJb6ADwWefeR3oBL JcBw== 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=uIV70OLO1UlDe0WGWVvP5BntLkj94bP8yACpwrRQpa8=; b=M0XLJJ1nbG5VSAqp7JBftfk2h8OqymBLGSF1+FzqwT3aXUqJZ9SRmn5uOuAWyRBjCU hDL/uV2ZekmN2PU/6OQxsQ4qhw/tKKwj8zuryCnUVTdF6TK41xQEL24qtUIVKhryee2t wLs8yiTlP/31a6Dwej8s4C1GfOk6tTYebc50BGbaAvqfoECTxGIiYqE8kQWcaOscuxqW SBpOuY04P0w3BZ42+kD71xuUqcbyyDOtJ2WADKD/JNLj1+7iJLPuWfSk74PBxrdp4ca6 JQJaWtkSILlEfq0sf8yfROeTqSHOFtebjhfxEVtLINFIHyrUAiNXS5uDnF3lIvtgnt3I csFQ== X-Gm-Message-State: AN3rC/7gdL4TQ8++dNBmwmNvVlE5elHJKPQGhkTABYsji6g2C1FTgh2s R/E3WES2rhlK6XKEOs5Toai1WHtAicv9ycSSyodQKEJv0O18DBxtkDV9lqyxf97vg7vuHJ6q8+y zxd1GdRInjuEVj7NLxbc/t+36EYXcwYvaPRhs8pizjogYLH2a1CAUHofdH60ifFNRacZvZwxa3D eadQ== X-Received: by 10.223.163.21 with SMTP id c21mr36425116wrb.38.1494320245501; Tue, 09 May 2017 01:57: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 x9sm9987992wmb.21.2017.05.09.01.57.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 01:57:24 -0700 (PDT) Subject: Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling) To: Masahiko Sawada 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> <2b931e0e-d9f2-c79e-b74b-91df2f915e66@2ndquadrant.com> <96e95255-94d9-0881-16ba-bdb6d05bb307@2ndquadrant.com> <52a1f160-db1f-49c6-9832-498dbea58ae8@2ndquadrant.com> <35f3592b-8582-e348-1823-f8edfcf03ba3@2ndquadrant.com> <5f6ad263-af87-2aee-b86b-8bf7e3260b73@2ndquadrant.com> Cc: Peter Eisentraut , Tom Lane , Robert Haas , Michael Paquier , PostgreSQL mailing lists From: Petr Jelinek Message-ID: <3e59fc8e-fdd0-6cc5-b2c1-cf030e19e45b@2ndquadrant.com> Date: Tue, 9 May 2017 10:57:24 +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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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 09/05/17 10:51, Masahiko Sawada wrote: > On Tue, May 9, 2017 at 5:39 PM, Petr Jelinek > wrote: >> On 09/05/17 07:07, Peter Eisentraut wrote: >>> On 5/8/17 23:23, Peter Eisentraut wrote: >>>> The way this uses RESTRICT and CASCADE appears to be backwards from its >>>> usual meaning. Normally, CASCADE when dropping an object that is still >>>> used by others will cause those other objects to be dropped. The >>>> equivalent here would be DROP REPLICATION SLOT + CASCADE would drop the >>>> subscription. >>>> >>>> What we want to simulate instead is an "auto" dependency of the slot on >>>> the subscription. So you can drop the slot separately (subject to other >>>> restrictions), and it is dropped automatically when the subscription is >>>> dropped. To avoid that, you can disassociate the slot from the >>>> subscription, which you have implemented. >>>> >>>> I think we can therefore do without RESTRICT/CASCADE here. If a slot is >>>> associated with the subscription, it should be there when we drop the >>>> subscription. Otherwise, the user has to disassociate the slot and take >>>> care of it manually. So just keep the "cascade" behavior. >>>> >>>> Similarly, I wouldn't check first whether the slot exists. If the >>>> subscription is associated with the slot, it should be there. > > IIUC in this design, for example if we mistakenly create a > subscription without creating replication slot and corresponding > replication slot doesn't exist on publisher, we cannot drop > subscription until we create corresponding replication slot manually. > Isn't it become a problem for user? > We can, that's why the NONE value for slot name was added by the patch so that subscription can be made "slot-less". The change of RESTRICT/CASCADE behavior that Peter made is just about whether we refuse to drop subscription by default when there is slot associated with or if we just go straight to dropping the slot. -- 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