Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5XlQ-0001la-G8 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2017 13:22:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d5XlQ-0006jJ-2c for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2017 13:22:48 +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 1d5XlN-0006fL-5y for pgsql-hackers@postgresql.org; Tue, 02 May 2017 13:22:45 +0000 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d5XlG-0004Gy-9Q for pgsql-hackers@postgresql.org; Tue, 02 May 2017 13:22:44 +0000 Received: by mail-wr0-x22e.google.com with SMTP id l50so80129190wrc.3 for ; Tue, 02 May 2017 06:22:37 -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=UGKiPZ7M/8bPHqrWAQlW5t6+YR6CRnFdpQeitBOQ7Vs=; b=vzDVox+j/36L7ow2nqnk++IkzPA8Mqbytk8tgIKKQuNLiGrWdCqaZ8gVmkyXS/1bAB WPurpCykp/yOX8u3/bNh5lGQXJH3uaAl7IbffviQcRBr48Re0wADmvvRLoPJ40u7LQfL qo9FaoFdhNyZYH8SjM2mbo6Hgpnt+Igxj36cWE1m7VqdDDRuHKAFej5ufiBvCfB1r5xs anNFyW+N6CjyE6Qt0pXu2QJ83NaAHc0mYtGHfVD/hLEaB2VdW4v1pjHR6gOfMnj9idH3 z+QczZnfOnCkYN730OuUx47LM9vpvyryrWBt1wIhaa9IABl6FkEMXo6qytoMtTB2iRPW +P3w== 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=UGKiPZ7M/8bPHqrWAQlW5t6+YR6CRnFdpQeitBOQ7Vs=; b=XVTuOntzHR547aoEflxXUS3iiANnHSVRTJqYqAh1PC3/K3GfmC88BLtxe4nU3IH1qx dOSJZd8STvqgqxPZvpf6mCcz5LLsb/bPBsM1Jyvdq/V/ViEymnAeGZ6z1NY0brU2ZA2Y OzD2mIn/HJrBGGdCliCI67Xscz5GLQMs8batyogeAzWs4lS4hrAjvB9cfhGFQ3fgtg9i nP3YKXxbHhltrrvca2cmjAQzA0dJxITvAkIzpnnxn0InYKxAAZmmyHJnx9Dbv+mAnFKz 5rfjipRf4mVvjeKVLgHpP4A31OlcOKyBBsIk3VKEnPYBzCpxS6BGUHk/pV4/R+byi+ZV v/NA== X-Gm-Message-State: AN3rC/7+8r0p1c48ml1BEJEhPLGLjVY7Peje+K8N4UlbKH3UobRYILjc teoGwKcHiCn0tsfvb00YxF6sGZnPtfpcuGNVFYsCOFT/1B6tDrrfSSPHqXu1/CJc1ngY0cfy23d y7o4dXtfoEL4mtCdacG5emfOOsyRzM0TAXYDl9Kx7msjIUQJ2EkN49mQRWgV54jZ+dBPtafk8 X-Received: by 10.223.164.208 with SMTP id h16mr10870637wrb.142.1493731355751; Tue, 02 May 2017 06:22:35 -0700 (PDT) Received: from [192.168.0.105] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id h8sm969657wmf.28.2017.05.02.06.22.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 06:22:34 -0700 (PDT) Subject: Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling) To: Tom Lane , Robert Haas References: <27478.1493727233@sss.pgh.pa.us> <29431.1493730652@sss.pgh.pa.us> <360a1932-7af4-609b-94f1-2ad419430869@2ndquadrant.com> Cc: Michael Paquier , PostgreSQL mailing lists From: Petr Jelinek Message-ID: <9174dc31-787a-a2f6-818f-cb4a5c1dfddb@2ndquadrant.com> Date: Tue, 2 May 2017 15:22:34 +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: <360a1932-7af4-609b-94f1-2ad419430869@2ndquadrant.com> Content-Type: text/plain; charset=windows-1252 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 02/05/17 15:14, Petr Jelinek wrote: > On 02/05/17 15:10, Tom Lane wrote: >> Robert Haas writes: >>>> On Thu, Apr 20, 2017 at 7:46 AM, Petr Jelinek >>>> wrote: >>>>> DROP SUBSCRIPTION mysub NODROP SLOT; >> >>>> I'm pretty uninspired by this choice of syntax. >> >> Actually, this command has got much worse problems than whether you like >> the spelling of its option: it shouldn't have an option in the first >> place. I put it to you as an inviolable rule that no object DROP command >> should ever have any options other than RESTRICT/CASCADE and IF EXISTS. >> If it does, then you don't know what to do when the object is recursed >> to by a cascaded drop. >> >> It's possible that we could allow exceptions to this rule for object types >> that can never have any dependencies. But a subscription doesn't qualify >> --- it's got an owner, so DROP OWNED BY already poses this problem. Looks >> to me like it's got a dependency on a database, too. (BTW, if >> subscriptions are per-database, why is pg_subscription a shared catalog? >> There were some pretty schizophrenic decisions here.) > > Because otherwise we would need launcher process per database, not pretty. > >> >> So ISTM we need to get rid of the above-depicted syntax. We could instead >> have what-to-do-with-the-slot as a property of the subscription, >> established at CREATE SUBSCRIPTION and possibly changed later by ALTER >> SUBSCRIPTION. Not quite sure what to call the option, maybe something >> based on the concept of the subscription "owning" the slot. >> > > So what do you do if the upstream does not exist anymore when you are > dropping subscription? > 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. -- 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