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 1jRP4d-0006nQ-IK for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Apr 2020 23:46:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRP4b-0005dX-HC for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Apr 2020 23:46:33 +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 1jRP4a-0005dQ-00 for pgsql-bugs@lists.postgresql.org; Wed, 22 Apr 2020 23:46:33 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRP4V-0005YK-V9 for pgsql-bugs@lists.postgresql.org; Wed, 22 Apr 2020 23:46:31 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C2068467; Wed, 22 Apr 2020 19:46:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 22 Apr 2020 19:46:24 -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=lTeaZMHxyAw1tqb9jQY417IRlbc Mx80KT9bwIvQqHrc=; b=JDW1zvzj0fRrh7cJIhPNxx90IFr+cL0fsOuJlbl+mWh 48r8qNuK87hV46AxiAiMBaXqtA3TlrTbK6gkqOuC7ZQOe339M2ZK1853DwcPvs5w tbz58MU0iZHJaLfyDgexJQF59YJRn/9kW8VqKYjRJBth7ePvrsS1zEPYl71ypsES rqu5zqGCcBDtXkiuWgWQLeAOLjn0vIMdg1LkpTQnuH1KezVvS1Ev4UosUL86cMYS oarjY8hrWCq09J+tAKoYmxjU+ITs1dBTWeVrvvU3G/KiHqHQdzQC8f0RNZY90FBb vNL5gQouerk7IoCXuK9M20ex9URU8aIj/yXJYFp1C5g== 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=lTeaZM HxyAw1tqb9jQY417IRlbcMx80KT9bwIvQqHrc=; b=i6AlQktofn+Z4s9lD3Zs+z 13Lr2j3gHT+HEN+/WsHr9FuXYj23vfnMFsoZyoN3j9Xa+EyyZ0F20P7UYSZ9maQF A0ZFn7KXnejw9yEUWYa9W8iFMP9AaaPrlmtzcXOXxjqzjIlZ1zniRf6rbVQGyXfj EaE8yRNNu3D/vCQ6ur9rftfhEhZNamQc6pKX8kbvu+mfqso3N3qVUd5dZrFHpZDq wt6Zk2SBh3DDwddC3SqDtdImzGR9mAumU1GwNxgOU7dYCMUZUZxtnGIWmG4ZOYNu UCaW/5sEIHTn3XypxniaIe62T7lDRrNFtfk/weWP9TVqnL8PLSjYvpZHJFbZXhfQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeekgddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutd dvrddukedtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii 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 AE5DE3065CE9; Wed, 22 Apr 2020 19:46:21 -0400 (EDT) Date: Thu, 23 Apr 2020 08:46:18 +0900 From: Michael Paquier To: Jehan-Guillaume de Rorthais Cc: 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: <20200422234618.GI33034@paquier.xyz> References: <20200418092611.GD350229@paquier.xyz> <20200420.160231.719176619682386260.horikyota.ntt@gmail.com> <20200420073444.GA77439@paquier.xyz> <20200420142235.1536a73b@firost> <20200421021501.GE77439@paquier.xyz> <20200422004121.516a5a32@firost> <20200422011935.GF33034@paquier.xyz> <20200422073223.GG33034@paquier.xyz> <20200422175824.637bda91@firost> <20200422181717.491fb499@firost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="00hq2S6J2Jlg6EbK" Content-Disposition: inline In-Reply-To: <20200422181717.491fb499@firost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00hq2S6J2Jlg6EbK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 22, 2020 at 06:17:17PM +0200, Jehan-Guillaume de Rorthais wrote: > I found an extra useless line of code in v9 patch. Please, find in > attachment v10. Sorry for this. Thanks for helping here, your changes make sense. This looks mostly fine to me except that part: +$standby1->poll_query_until('postgres', + qq{ SELECT pg_xlog_location_diff('$primary_lsn', pg_last_xlog_replay_location()) = 0 }) + or die "Timed out while waiting for xlog replay"; Here we should check if $primary_lsn is at least pg_last_xlog_replay_location(). Checking for an equality may stuck the test if more WAL gets replayed. For example you could have a concurrent autovacuum generating WAL. -- Michael --00hq2S6J2Jlg6EbK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl6g10kACgkQnvQgOdby QH1OeA/+IQWkgsNnP0DdfFDmtWz3thGsJ+J49ZtWrWT5sO2fSemrUFLPeQnigDFF U1m0lHZCFwRsU5nGuGqpNMy482b2w1w5UkraTFC9jYlklzRe4pPfGH/TvxINmAZn 4q8G3f9DfjKmkVly+hTrVlCOI3itshEIxCeOK6OSjZO2JM36PiMZ2xlSGSJz0V08 E7TZbOD0xyKJLDSA+a6S0fAvVYCTTOvrl15fEAJznER1Ws6uQSaow6cPBSh/d2tD x6V2g2IOFO5JEJorUbIPN/AX7pFt/3zZuMj9mmjqCCrYpN6QcnJiF8BZt2gWMzl1 AHeJxFNBGinjwYQ65XID1Cq5l+hUPAzw1Kd4xfpAgwk//bJ40LCBB7SmFB5hj8F1 2qamlOei0818ht51gHglCAdyPZkdxOxkbYr5cgSpukHwzr53q9Hd+io3Ze5ecAQE esevFY4feUKg6IyRSGkHKXdziORDd677O2pFJ76TCWqtZ1sR+hJXGw2QbEO86A2P 2zynf7quJ9w4t7sLXs65hyfGQkLlzi+r0bdDxrjYLkdN7qI3M0FCWOvZtq8OhDps fTIBK41griOQRW/sL71zUKBLgvbrjf/EGccB1tasVRVw/v4BY+TZ7Jmd8N+k6rL4 BwkzGUFB07HXO15mW7Q/0ElW5MUvtdJIm63LcieiSVR+DGEASEU= =lAkZ -----END PGP SIGNATURE----- --00hq2S6J2Jlg6EbK--