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 1htgD4-0000Sh-GL for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Aug 2019 22:39:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1htgD3-0003Hq-Bd for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Aug 2019 22:39:37 +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 1htgD3-0003Ga-39 for pgsql-hackers@lists.postgresql.org; Fri, 02 Aug 2019 22:39:37 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1htgD0-00041H-7v for pgsql-hackers@postgresql.org; Fri, 02 Aug 2019 22:39:36 +0000 Received: by mail-pf1-x444.google.com with SMTP id g2so36714073pfq.0 for ; Fri, 02 Aug 2019 15:39:33 -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=ZXV2P+inuX99FmcZKuf2BSTiqiapDVzUaTq5yWKqhfg=; b=Rl3MB81ZD5Evpk5fiG8W8LPyLztNI5LrjW60AAFDhq2xmDb70+Z4Py9nBRi8GnbE5A TrL7chDYiFGfJw4WPPbbpjB+J5LaIz5r2qTOIznX8rDTkt59uipp2vfp37Q5iK+lhs4l YCyjB1JKGw1aaxG0O2MvI2e50eChTKEtNtZc+DZOPlDFj8R66iHAGEhhY9bhKhVXEiqQ ccHPNST0P6TaiKZuh2pFfI7UGa9B1jY1QS7OCwL1NfJkYRBwWp4jW7EFYfU7UjWojtof 4uc8po6uFZHNzDEnyWgCKcweEYnnIiKCedhrM5x0K+z0g/FnlQJsbUpo6h92u4AHEEK0 +cmQ== 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=ZXV2P+inuX99FmcZKuf2BSTiqiapDVzUaTq5yWKqhfg=; b=ZGugHZD9HGniA+C+Tqio3NV+VT+w5LCTMNr3VXw3PpdxBqcvtjMT+/Uikvme2nemcn mPeFlUkkbaeX90c1q0uFgZkXbL5oAFGP0MQ1CVvYC5COS11y6aFNIzfxDt3UaTjNpEqy sPN2HQr8JhJMlReI/P7W7OBJw5peJVv6ntgfOf2M3vvH+u98qOnXaOhbXdqnSok3IbTt yjQQaV2e3uTC0aBg3fBHGK1TuqAh3Bg7BTKa+VmesEG1OzW/RYuDAwuBX6lFVA5kX4QY wsDuwjXuXwxt+uoxAxNbmiQHN3R6S3Yt8Yxf0NuhZ8+tmu0UU0FI45O/UZYXH0ekhMGP RsEw== X-Gm-Message-State: APjAAAXTu7CiO9MqCMPYPjWPV5INVTWandiPq9KKx9SXBLLdlDTFLtZ8 SJy+FkeXWs+Tx4zkqd1kZ/Itsw2asFqTdelYGxbkuUwRgqHQbWwuNqMFd0DAoxj1awyOEhyyIY1 T8ZdvoU9P/eXnx8kQHdPIlQAg3IzhLIqZzBI8mRSIW4f5otvGKwxTCIcgHRYKJ9qcjdsJNIpZHr cjP4FXMtiWjJi9 X-Google-Smtp-Source: APXvYqwH7bw/UxvpY0aOLh+qkz+6OyFiwv1TvcjP9I1u9WB8LHc2MQmxFleC16TWGesHQ5JVeFlv3w== X-Received: by 2002:a63:5402:: with SMTP id i2mr99203433pgb.414.1564785571368; Fri, 02 Aug 2019 15:39:31 -0700 (PDT) Received: from osaka.octopusnet (p8460114-ipngn40401marunouchi.tokyo.ocn.ne.jp. [180.57.170.114]) by smtp.gmail.com with ESMTPSA id g66sm74830799pfb.44.2019.08.02.15.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Aug 2019 15:39:30 -0700 (PDT) Subject: Re: [PATCH] Stop ALTER SYSTEM from making bad assumptions To: Tom Lane , Tomas Vondra Cc: Amit Kapila , Stephen Frost , Robert Haas , "pgsql-hackers@postgresql.org" References: <20372.1561134638@sss.pgh.pa.us> <20190621164028.GO2480@tamriel.snowman.net> <21353.1561136112@sss.pgh.pa.us> <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> From: Ian Barwick Message-ID: Date: Sat, 3 Aug 2019 07:39:27 +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: <31697.1564784856@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 8/3/19 7:27 AM, Tom Lane wrote: > Tomas Vondra writes: >> There seems to be a consensus that this this not a pg_basebackup issue >> (i.e. duplicate values don't make the file invalid), and it should be >> handled in ALTER SYSTEM. > > Yeah. I doubt pg_basebackup is the only actor that can create such > situations. > >> The proposal seems to be to run through the .auto.conf file, remove any >> duplicates, and append the new entry at the end. That seems reasonable. > > +1 > >> There was a discussion whether to print warnings about the duplicates. I >> personally see not much point in doing that - if we consider duplicates >> to be expected, and if ALTER SYSTEM has the license to rework the config >> file any way it wants, why warn about it? > > Personally I agree that warnings are unnecessary. Having played around with the pg.auto.conf stuff for a while, my feeling is that ALTER SYSTEM does indeed have a license to rewrite it (which is what currently happens anyway, with comments and include directives [1] being silently removed) so it seems reasonable to remove duplicate entries and ensure the correct one is processed. [1] suprisingly any include directives present are honoured, which seems crazy to me, see: https://www.postgresql.org/message-id/flat/8c8bcbca-3bd9-dc6e-8986-04a5abdef142%402ndquadrant.com >> The main issue however is that no code was written yet. > > Seems like it ought to be relatively simple ... but I didn't look. The patch I originally sent does exactly this. The thread then drifted off into a discussion about providing ways for applications to properly write to pg.auto.conf while PostgreSQL is not running; I have a patch for that which I can submit later (though it is a thing of considerable ugliness). Regards Ian Barwick -- Ian Barwick https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services