Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb4bn-0007ID-2r for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Nov 2020 16:29:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kb4bl-00009q-H8 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Nov 2020 16:29:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb4bl-00009B-9g for pgsql-hackers@lists.postgresql.org; Fri, 06 Nov 2020 16:29:01 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb4be-0002f6-Ey for pgsql-hackers@postgresql.org; Fri, 06 Nov 2020 16:29:00 +0000 Received: from hnk.local (p1295030-ipngn4902funabasi.chiba.ocn.ne.jp [153.166.85.30]) by oss.nttdata.com (Postfix) with ESMTPSA id 183006238E; Sat, 7 Nov 2020 01:28:50 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: Allow some recovery parameters to be changed with reload To: Sergei Kornilov , Kyotaro Horiguchi , "a.lubennikova@postgrespro.ru" Cc: "robertmhaas@gmail.com" , "michael@paquier.xyz" , "andres@anarazel.de" , "peter.eisentraut@2ndquadrant.com" , "pgsql-hackers@postgresql.org" References: <20200809052149.GB17986@paquier.xyz> <1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru> <20201022.110026.524650499365127827.horikyota.ntt@gmail.com> <4920201603879284@mail.yandex.ru> <0e0d5982-ac64-818d-1ec6-18a80b9300b1@oss.nttdata.com> <56311604665173@mail.yandex.ru> From: Fujii Masao Message-ID: Date: Sat, 7 Nov 2020 01:28:49 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <56311604665173@mail.yandex.ru> 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 2020/11/06 21:36, Sergei Kornilov wrote: > Hello > >> Currently when restore_command is not set, archive recovery fails >> at the beginning. With the patch, how should we treat the case where >> retore_command is reset to empty during archive recovery? We should >> reject that change of restore_command? > > Good point. I think we should reject that change. But (AFAIC) I cannot use GUC check callback for this purpose, as only the startup process knows StandbyModeRequested. I think it would be appropriate to call validateRecoveryParameters from StartupRereadConfig. I don't think this idea is ok because emptying restore_command and the reload of configuration file could cause the server doing archive recovery to shut down with FATAL error. I'm wondering if it's safe to allow restore_command to be emptied during archive recovery. Even when it's emptied, archive recovery can proceed by reading WAL files from pg_wal directory. This is the same behavior as when restore_command is set to, e.g., /bin/false. So maybe we don't need to treat the empty restore_command so special?? OTOH, we should not remove the check of restore_command in validateRecoveryParameters(). Otherwise, when users forget to specify restore_command when starting archive recovery, recovery could wrongly proceed and the database could get corrupted. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION