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 1nGw05-0005OD-MT for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 04:51:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nGw04-0006kO-Cm for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 04:51:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nGw03-0006kE-Qn for pgsql-hackers@lists.postgresql.org; Mon, 07 Feb 2022 04:51:39 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nGw00-0004Rp-F2 for pgsql-hackers@lists.postgresql.org; Mon, 07 Feb 2022 04:51:38 +0000 Received: from [192.168.11.9] (p2019072-ipbf2307funabasi.chiba.ocn.ne.jp [122.30.130.72]) by oss.nttdata.com (Postfix) with ESMTPSA id B92EF612DC; Mon, 7 Feb 2022 13:51:31 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.5 at oss.nttdata.com Message-ID: Date: Mon, 7 Feb 2022 13:51:31 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: Add checkpoint and redo LSN to LogCheckpointEnd log message Content-Language: en-US To: Kyotaro Horiguchi Cc: bharath.rupireddyforpostgres@gmail.com, nathandbossart@gmail.com, sfrost@snowman.net, bossartn@amazon.com, rjuju123@gmail.com, michael@paquier.xyz, pgsql-hackers@lists.postgresql.org References: <20220203.155053.170368585238406731.horikyota.ntt@gmail.com> <7de7f720-666c-ea97-8926-7bc4c43f482a@oss.nttdata.com> <20220207.101634.205396783432098074.horikyota.ntt@gmail.com> <20220207.120258.310426179780547983.horikyota.ntt@gmail.com> From: Fujii Masao In-Reply-To: <20220207.120258.310426179780547983.horikyota.ntt@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022/02/07 12:02, Kyotaro Horiguchi wrote: > - If any later checkpoint/restartpoint has been established, just skip > remaining task then return false. (!chkpt_was_latest) > (I'm not sure this can happen, though.) > > - we update control file only when archive recovery is still ongoing. This comment seems to conflict with what your PoC patch does. Because with the patch, ControlFile->checkPoint and ControlFile->checkPointCopy seem to be updated even when ControlFile->state != DB_IN_ARCHIVE_RECOVERY. I agree with what your PoC patch does for now. When we're not in archive recovery state, checkpoint and REDO locations in pg_control should be updated but min recovery point should be reset to invalid one (which instruments that subsequent crash recovery should replay all available WAL files). > - Otherwise reset minRecoveryPoint then continue. > > Do you have any thoughts or opinions? Regarding chkpt_was_latest, whether the state is DB_IN_ARCHIVE_RECOVERY or not, if checkpoint and redo locations in pg_control are updated, IMO we don't need to skip the "remaining tasks". Since those locations are updated and subsequent crash recovery will start from that redo location, for example, ISTM that we can safely delete old WAL files prior to the redo location as the "remaining tasks". Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION