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 1nMC2U-00010S-Dm for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 16:59:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nMC2T-0001Pw-9Q for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Feb 2022 16:59:53 +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 1nMC2T-0001Pn-06 for pgsql-hackers@lists.postgresql.org; Mon, 21 Feb 2022 16:59:53 +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 1nMC2Q-0000sf-Jb for pgsql-hackers@lists.postgresql.org; Mon, 21 Feb 2022 16:59:52 +0000 Received: from [192.168.11.10] (p2010165-ipbf2302funabasi.chiba.ocn.ne.jp [122.25.95.165]) by oss.nttdata.com (Postfix) with ESMTPSA id A04F860792; Tue, 22 Feb 2022 01:59:46 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.5 at oss.nttdata.com Message-ID: <01b8ecd8-7d95-1bff-7f8c-fac3d530aab7@oss.nttdata.com> Date: Tue, 22 Feb 2022 01:59:45 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 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: <20220209.115204.1794224638476710282.horikyota.ntt@gmail.com> <20220214.144022.2233054833762514893.horikyota.ntt@gmail.com> From: Fujii Masao In-Reply-To: <20220214.144022.2233054833762514893.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/14 14:40, Kyotaro Horiguchi wrote: > For backbranches, the attached for pg14 does part of the full patch. Thanks for updating the patch! > Of the following, I think we should do (a) and (b) to make future > backpatchings easier. > > a) Use RedoRecPtr and PriorRedoPtr after they are assigned. > > b) Move assignment to PriorRedoPtr into the ControlFileLock section. I failed to understand how (a) and (b) can make the backpatching easier. How easy to backpatch seems the same whether we apply (a) and (b) or not... > c) Skip udpate of minRecoveryPoint only when the checkpoint gets old. Yes. > d) Skip call to UpdateCheckPointDistanceEstimate() when RedoRecPtr <= > PriorRedoPtr. But "RedoRecPtr <= PriorRedoPtr" will never happen, will it? Because a restartpoint is skipped at the beginning of CreateRestartPoint() in that case. If this understanding is right, the check of "RedoRecPtr <= PriorRedoPtr" is not necessary before calling UpdateCheckPointDistanceEstimate(). + ControlFile->minRecoveryPoint = InvalidXLogRecPtr; + ControlFile->minRecoveryPointTLI = 0; Don't we need to update LocalMinRecoveryPoint and LocalMinRecoveryPointTLI after this? Maybe it's not necessary, but ISTM that it's safer and better to always update them whether the state is DB_IN_ARCHIVE_RECOVERY or not. if (flags & CHECKPOINT_IS_SHUTDOWN) ControlFile->state = DB_SHUTDOWNED_IN_RECOVERY; Same as above. IMO it's safer and better to always update the state (whether the state is DB_IN_ARCHIVE_RECOVERY or not) if CHECKPOINT_IS_SHUTDOWN flag is passed. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION