Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htgsi-0001ls-L7 for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Aug 2019 23:22:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1htgsh-0007SN-H3 for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Aug 2019 23:22:39 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1htgsh-0007LX-5d for pgsql-hackers@lists.postgresql.org; Fri, 02 Aug 2019 23:22:39 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htgse-0004W7-DV for pgsql-hackers@postgresql.org; Fri, 02 Aug 2019 23:22:38 +0000 Received: by mail-pg1-x543.google.com with SMTP id o13so36758671pgp.12 for ; Fri, 02 Aug 2019 16:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wKu6O58/SlnFEvF1Q2aNL1VaJya5AgE5q6mUSKsdLn4=; b=B2lcbfP08vPIbHZRdue/aT4Yn7YapXUagFHMmL8TDf8w16SWRQMg6TmbYbrrZBAjQI cDM1Pli5bhYJ/ki1kle0YrX9ZxBDaxHoNxJWULDcxpwWF6Jx/9Tq6w8wAWPC/zEOnuC+ iOCVgWJ9MZuI6dDJtDgsPBs/G4j21fyn1gZVLyVPRIOcYPxP6RbefvMnZ/P/MflSylow LMcAkVI9D4SQj1IUqfpEFk7qIM4VRwuLJoq16dGFuX6bSzAzeRtys1lkaCHbSxv1F5qr Qb1nRF4zou7ARAKl6xBM+PuIQx4XIFZty9Hx6F5Q99p25Lnfg+ig4IQNhACwNrnMBkca 5jyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wKu6O58/SlnFEvF1Q2aNL1VaJya5AgE5q6mUSKsdLn4=; b=R6tJSY3+qV4Gj4zq9uMnWKK54IWfBsiGN2uD7QykIkFvu1+g2w1f5AiE4lkwR+7P2a C6u4vTcxQ1Yo+1MfSabFgfeFlsNCX6kYzZ27wUAtl+h3Wh8HqXcQ3YV6qWKRMDMGSSRQ aypMwm3fRy7oJRRyuAdyU120S53GDJa9JLvhCgf+eltBYH39HpeiU72V2I/MBHu3xEsb lzUqMKMdhKAXJLAzvOW1Md+oxpPJVOhYFqipXQKYlGSNyBrxdYviCiIvTOjwRqaSFx34 pf6E/+uyLGbFMeO9REIbQDf2n+gxZ/1SNJlllZ0QT9PQnkIjZm3gM3n1R6eXh3XXMeCx DOVg== X-Gm-Message-State: APjAAAU4HjaccnGSq2uI/iA+llJMI8Pl3C71+h0l+GfTnu5f7O1845WQ UpA7pd5WHEYnXtky0pMAX+mIGOdQSSQ5ddArjCNTs1ZBXPLc9sB+bSC/FLJuS0QqMdsTzwdDIV7 xD4QDZAgqKon9c7jtT3pJqT++Jp426R4AFI5YJNRj98h0v9p8FbW+XxnyVQMQISlRi7bsKEi+NF zLIx+OPzUNlZsU X-Google-Smtp-Source: APXvYqwqHaB1D1gMFKa9+W6fmXPrXtXTEb3XckezOfguk4Bap6I98o52CMbnQPHIVsE6IYouJRkSrQ== X-Received: by 2002:a62:5c3:: with SMTP id 186mr16058326pff.144.1564788153213; Fri, 02 Aug 2019 16:22:33 -0700 (PDT) Received: from osaka.octopusnet (p8460114-ipngn40401marunouchi.tokyo.ocn.ne.jp. [180.57.170.114]) by smtp.gmail.com with ESMTPSA id r1sm70192087pgv.70.2019.08.02.16.22.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Aug 2019 16:22:32 -0700 (PDT) Subject: Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions To: Andres Freund , Tom Lane Cc: Stephen Frost , Amit Kapila , Robert Haas , Tomas Vondra , "pgsql-hackers@postgresql.org" References: <20190624185647.GW2480@tamriel.snowman.net> <15032.1561403529@sss.pgh.pa.us> <20190624192014.GB2480@tamriel.snowman.net> <56aff4f3-dec8-f462-7feb-0938411b04a6@2ndquadrant.com> <20190802222254.qsvqjtkwte464lu3@development> <31697.1564784856@sss.pgh.pa.us> <32681.1564786027@sss.pgh.pa.us> <20190802225640.gm7bhwkgctzje4su@alap3.anarazel.de> From: Ian Barwick Message-ID: Date: Sat, 3 Aug 2019 08:22:29 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190802225640.gm7bhwkgctzje4su@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/3/19 7:56 AM, Andres Freund wrote: > Hi, > > On 2019-08-02 18:47:07 -0400, Tom Lane wrote: >> Stephen Frost writes: >>> I disagree that this should only be addressed in alter system, as I’ve said >>> before and as others have agreed with. Having one set of code that can be >>> used to update parameters in the auto.conf and then have that be used by >>> pg_basebackup, alter system, and external tools, is the right approach. >> >> I don't find that to be necessary or even desirable. Many (most?) of the >> situations where this would be important wouldn't have access to a running >> backend, and maybe not to any PG code at all --- what if your tool isn't >> written in C? > > I think a commandline tool to perform the equivalent of ALTER SYSTEM on > a shutdown cluster would be a great tool. It's easy enough to add > something with broken syntax, and further down the road such a tool > could not only ensure the syntax is correct, but also validate > individual settings as much as possible (obviously there's some hairy > issues here). What I came up with shoehorned a stripped-down version of the backend config parser into fe_utils and provides a function to modify pg.auto.conf in much the same way ALTER SYSTEM does, but with only the basic syntax checking provided by the parser of course. And for completeness a client utility which can be called by scripts etc. I can clean it up and submit it later for reference (got distracted by other things recently) though I don't think it's a particularly good solution due to the lack of actual checks for the provided GUCSs (and the implementation is ugly anyway); something like what Andres suggests below would be far better. > Quite possibly the most realistic way to implement something like that > would be a postgres commandline switch, which'd start up far enough to > perform GUC checks and execute AlterSystem(), and then shut down > again. We already have -C, I think such an option could reasonably be > implemented alongside it. > > Obviously this is widely out of scope for v12. Regards Ian Barwick -- Ian Barwick https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services