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 1njR9h-0008HB-BN for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2022 19:47:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njR9e-0008Qr-Mu for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Apr 2022 19:47:22 +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 1njR9e-0008OY-DV for pgsql-hackers@lists.postgresql.org; Tue, 26 Apr 2022 19:47:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njR9Z-0001jv-5N for pgsql-hackers@lists.postgresql.org; Tue, 26 Apr 2022 19:47:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 23QJlDeP258773; Tue, 26 Apr 2022 15:47:14 -0400 From: Tom Lane To: "=?ISO-8859-1?B?WmhhbyBSdWk=?=" <875941708@qq.com> cc: pgsql-hackers@lists.postgresql.org, Kyotaro Horiguchi , masao.fujii@oss.nttdata.com, Nathan Bossart Subject: Re: Fix primary crash continually with invalid checkpoint after promote In-reply-to: References: Comments: In-reply-to "=?ISO-8859-1?B?WmhhbyBSdWk=?=" <875941708@qq.com> message dated "Tue, 26 Apr 2022 15:16:13 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <258771.1651002433.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Apr 2022 15:47:13 -0400 Message-ID: <258772.1651002433@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "=3D?ISO-8859-1?B?WmhhbyBSdWk=3D?=3D" <875941708@qq.com> writes: > Newly promoted primary may leave an invalid checkpoint. > In function CreateRestartPoint, control file is updated and old wals are= removed. But in some situations, control file is not updated, old wals ar= e still removed. Thus produces an invalid checkpoint with nonexistent wal.= Crucial log: "invalid primary checkpoint record", "could not locate a val= id checkpoint record". I believe this is the same issue being discussed here: https://www.postgresql.org/message-id/flat/20220316.102444.219318148757661= 7583.horikyota.ntt%40gmail.com but Horiguchi-san's proposed fix looks quite different from yours. regards, tom lane