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 1jJzUZ-0001E0-FA for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Apr 2020 13:02:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJzUY-0006G9-1O for pgsql-bugs@arkaria.postgresql.org; Thu, 02 Apr 2020 13:02:42 +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 1jJzUX-0006Ff-G2 for pgsql-bugs@lists.postgresql.org; Thu, 02 Apr 2020 13:02:41 +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 1jJzUU-0002vT-U0 for pgsql-bugs@lists.postgresql.org; Thu, 02 Apr 2020 13:02:40 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 7068220A82; Thu, 2 Apr 2020 15:02:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1585832556; bh=J7LKliTgUEg5MBi30TSGKuRxgdT86rWVkimLDYGB5GI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TXmsrYftmBIdxuRWHfZGOrLI9IM+BsXWIlgygYXi3Da/OTxzIkVTLPE1i8aT4Volc zleD6ZQOF9BMZGepnAjzvqZW+U0ZGH2eoI37Poq0iCaLILZ7U+NMQ1TexatqSnPQvX CWDg0tBRD2nIpfvtFQyxTQmjIfow2TsLlsjwQHHE= Date: Thu, 2 Apr 2020 15:02:34 +0200 From: Jehan-Guillaume de Rorthais To: Kyotaro Horiguchi Cc: masao.fujii@oss.nttdata.com, pgsql-bugs@lists.postgresql.org, michael@paquier.xyz Subject: Re: [BUG] non archived WAL removed during production crash recovery Message-ID: <20200402150234.278ae845@firost> In-Reply-To: <20200402.130734.613319908534820379.horikyota.ntt@gmail.com> References: <20200401181735.11100908@firost> <20200402.130443.1791362864704140391.horikyota.ntt@gmail.com> <20200402.130734.613319908534820379.horikyota.ntt@gmail.com> 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 Thu, 02 Apr 2020 13:07:34 +0900 (JST) Kyotaro Horiguchi wrote: > Sorry, it was quite ambiguous. > > At Thu, 02 Apr 2020 13:04:43 +0900 (JST), Kyotaro Horiguchi > wrote in > > At Wed, 1 Apr 2020 18:17:35 +0200, Jehan-Guillaume de Rorthais > > wrote in > > > Please, find in attachment a patch implementing this. > > > > The patch partially reintroduces the issue the patch have > > fixed. Specifically a standby running a crash recovery wrongly marks a > > WAL file as ".ready" if it is extant in pg_wal without accompanied by > > .ready file. > > The patch partially reintroduces the issue the commit 78ea8b5daa have > fixed. Specifically a standby running a crash recovery wrongly marks a > WAL file as ".ready" if it is extant in pg_wal without accompanied by > .ready file. As far as I understand StartupXLOG(), NOT_IN_RECOVERY and IN_CRASH_RECOVERY are only set for production clusters, not standby ones. So the following test should never catch standby cluster as : (XLogArchivingActive() && inRecoveryState != IN_ARCHIVE_RECOVERY) Forgive me if I'm wrong, but do I miss something? Regards,