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 1jTDev-0004vk-30 for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2020 23:59:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTDeN-00081Z-5v for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2020 23:58:59 +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 1jTDeM-00081S-Nc for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2020 23:58:58 +0000 Received: from mail.dalibo.com ([212.85.157.172]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jTDeG-00025y-DM for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2020 23:58:58 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 2326B21583; Tue, 28 Apr 2020 01:58:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1588031929; bh=Vu2Z7jAtoYxmFKM0Cec8BfDu06LMuWp9vTFWiujMbKs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dte0BR3o8IO2dYAuEUoU7DyH6GX3YrgbJ6J1QzVtIcfMCnojlkPCN3BTK/4/5Zdjn 5HI9AGZtmI1YjNA2OFB3idqCTRhaEqk3pWzh7qAxomeTyj0VUL8jT30EJoSQgivkFP zJFZKqUivibEkwTvraZ5N4XrlWij99amqU78zC+A= Date: Tue, 28 Apr 2020 01:58:47 +0200 From: Jehan-Guillaume de Rorthais To: Michael Paquier Cc: Kyotaro Horiguchi , tgl@sss.pgh.pa.us, masao.fujii@oss.nttdata.com, pgsql-bugs@lists.postgresql.org Subject: Re: [BUG] non archived WAL removed during production crash recovery Message-ID: <20200428015847.7ea01c5c@firost> In-Reply-To: <20200427230138.GB169337@paquier.xyz> References: <20200424034248.GL33034@paquier.xyz> <20200424150300.1b3b0c20@firost> <20200427074945.GG11369@paquier.xyz> <20200427.182107.1145997462405167356.horikyota.ntt@gmail.com> <20200427230138.GB169337@paquier.xyz> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 28 Apr 2020 08:01:38 +0900 Michael Paquier wrote: > On Mon, Apr 27, 2020 at 06:21:07PM +0900, Kyotaro Horiguchi wrote: > > Agreed to the diagnosis and the fix. The fix reliably cause a restart > > point then the restart point manipulats the status files the right way > > before the CHECKPOINT command resturns, in the both cases. > > Thanks for checking! > > > If I would add something to the fix, the following line may need a > > comment. > > > > +# Wait for the checkpoint record is replayed so that the following > > +# CHECKPOINT causes a restart point reliably. > > |+$standby1->poll_query_until('postgres', > > |+ qq{ SELECT pg_wal_lsn_diff(pg_last_wal_replay_lsn(), > > '$primary_lsn') >= 0 } > > Makes sense, added a comment and applied to HEAD. I have also > improved the comment around the split with pg_switch_wal(), and > actually simplified the test to use as wait point the return value > from the function. Thank you guys for your help, reviews and commits!