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 1jRsPn-0001u6-Tq for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 07:06: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 1jRsPm-00068d-0U for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Apr 2020 07:06: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 1jRsPk-00068W-AB for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 07:06:21 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRsPg-0003gD-VD for pgsql-bugs@lists.postgresql.org; Fri, 24 Apr 2020 07:06:19 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 26E465C0A7C; Fri, 24 Apr 2020 03:06:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 24 Apr 2020 03:06:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=mUu1hL+XHvJDFk2NsfPNtQd/KMs fT2kYcHhpzFpCt5g=; b=Usc7CBgQYUDAeiyptKzdlX36smrWuKheWd9IsC8YN31 Tqducfja2MC46puQr2LI8/Gcpy73+cPJGZyHOQbMynNDd4f8k1UplhypLgXSBXQl mM5w4v85zCLuChO7KZI1GtUy78G/NKFF9ZAZJbuhQKOFBqcMkzkOmV2xRRWv+Wq3 Nj/Lsb2PYVYtNRDwy07hDDknY8jbybu6LlsnHiMePyTygaBTZdwHCJ3gD5kt66S1 Bjw5qobOvBRbhkUKZkhVODxh2viDnLMWjRD0QzcgRJCk4xyoYhMSTXeHwYg2peki q4G2jJo/84jPsJ7mM5cofjSkfCv8s1fCv11bAJ+WxLg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=mUu1hL +XHvJDFk2NsfPNtQd/KMsfT2kYcHhpzFpCt5g=; b=A8I2/QEWov28YCY//gVqvR rbY8yny6rPnGkC5rYf/l7rJRJmMaJX+9Epzj4kRSYaKHyC4ntBGVUYgAInZnjz5S qZvWF/5DcHX0OK9alkMtPWAIImrffZPQW000gOKsro/Ou+NqjlDf9Qlx6Z7Q4/m9 GA2FaXg9rghoeD8xtpxApCSuCMeduOSfRonXiJSstfhug6DvMmN3QUfsu6dHj6hG oFox9eLEbT/U1oZC+28Zuy2BXWL62qlDeMYVcgLfJxi+mer5H/bzq9VAQisRW2lQ w6UuVT1LNkhERLGyxXwgthxs0PrKI0D/foa3ChjmdNoD9DfDK84Q5ZxBBiO17CsQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrhedtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepudduuddruddtvddrudektddrudekheenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlse hprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 251F9328005D; Fri, 24 Apr 2020 03:05:41 -0400 (EDT) Date: Fri, 24 Apr 2020 16:05:10 +0900 From: Michael Paquier To: Andres Freund Cc: Jehan-Guillaume de Rorthais , Kyotaro Horiguchi , masao.fujii@oss.nttdata.com, pgsql-bugs@lists.postgresql.org Subject: Re: [BUG] non archived WAL removed during production crash recovery Message-ID: <20200424070510.GM33034@paquier.xyz> References: <20200422175824.637bda91@firost> <20200422181717.491fb499@firost> <20200422234618.GI33034@paquier.xyz> <20200423.140546.1055476118690602079.horikyota.ntt@gmail.com> <20200423185953.5f8e5b8f@firost> <20200423235402.GJ33034@paquier.xyz> <20200424014856.f3jvvcxxmt5p7k5z@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7UIJfHqpdi+oBJdT" Content-Disposition: inline In-Reply-To: <20200424014856.f3jvvcxxmt5p7k5z@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --7UIJfHqpdi+oBJdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 23, 2020 at 06:48:56PM -0700, Andres Freund wrote: > But don't we pretty much know this already from the state of the system? > During crash recovery there's nothing running RemoveOldXLogFiles() but > the startup process. Right? And in DB_IN_ARCHIVE_RECOVERY it should only > happen as part of restartpoints (i.e. the checkpointer). >=20 > Did you add the new shared state to avoid deducing things from the > "environment"? If so, it should really be mentioned in the commit > message & code. Because: Hmm. Sorry, I see your point. The key of the logic here is from XLogArchiveCheckDone() which could be called from other processes than the startup process. There is one code path at the end of a base backup for backup history files where not using a shared state would be a problem. -- Michael --7UIJfHqpdi+oBJdT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl6ij6YACgkQnvQgOdby QH1zJRAAmLc9SrjUOAJKkYzatUBu/D9dliLA1P+fHyC8hAVSkAX4TVyK6YIior9A 0nJL4gYuYOrpTY+G55WcJJmOiJcwaiNuFu1mwelMH/CKfpVtih/Oae3EdjdOQp0N g0ItBhXJgrmx+sMtp59H1UeGYdvU/zDOdPlCrGaK92PNrBJwDx5joMxt3qxUa80P E8YyFsHpeDgke6CIP9I4sPo5f6qR6K79wy9X4sEU6uMGbPsQ76zBOgNlerOKqAZR xsI6O6D1SoF4kss88FzS23HFNWTfFdrkT7Fh5EBgwwbYb+VuUqSnyVf25mGRjo3W LLxSFvXYgFTXe63oQyyKmF81rz9iqws3AI1mhYo4ji8DftSJqam/la+4RiLInqYF HAb6kz3HNuvftx6ORndz4CQAHyRluEj4jAWiWHHaKFCOcnAaDP4FmUAP3ha/XnU6 fJWAm1lS3krJOPCnXM2IykwO977horiMXRK+Gt3jw6VyF1907xiRIcOzpOHxq7Zc dIeQf2MAu7DZAaws07MKLFqo0Wqu9rbfw2Tuuc7qxmkcjVO8u1iPmHcBO6LU3jZi M/XjZGCKRxiVXvfcBE9uDZrF2yrO2foMttUaqXTEyApK6SBK1l0ydeR1ZEe0Xkld W73C3aDTpuY8F3+L3sPQeeyBi8M7TQRHgZhBD0J1fIviHJiYY/I= =uBN5 -----END PGP SIGNATURE----- --7UIJfHqpdi+oBJdT--