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 1jSyWc-00057R-Gt for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2020 07:49:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jSyWb-0004Vv-7U for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2020 07:49:57 +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 1jSyWb-0004Vo-15 for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2020 07:49:57 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jSyWY-0006fG-Ju for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2020 07:49:55 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id CFD096AC; Mon, 27 Apr 2020 03:49:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 27 Apr 2020 03:49:52 -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=t5874CyuQ5yEEBezotR44v+bW6N P6O+ZV0paT+1BgtM=; b=OhNwKy7gOgoFhmWJGZ1lwEAUrNbsjmsuGzdSB8yGQCA nzNYMj5tE/2Sm/FLW/4VnY10KckxBlmOr3+HeeAiYb16HN5GdEemwKALHzTUHkgl y1xo+hg8Ahx00ESiGT8I/BNEApg9VcMUyn+orvk+5m9gHfZHvgg3Kuv28nerXaFZ BGjqf/Eyr/EeNXirefpHlIevtnjre/DnZxZoZ+ugjP15wLH/2JdDicwbDFDh5p4B yqGJxAHcCC5g1O3+1dIHyX5lPuxFiU7ytAVERQ9AgyAhhJxUKqPi56bUeLXEvdd2 NeKnuow/lbFBXGandz+P/LmihQKEpHnt0jZBlaT9LOg== 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=t5874C yuQ5yEEBezotR44v+bW6NP6O+ZV0paT+1BgtM=; b=0YvppyUgrTuft036HLC9iK 1DEZPhV1CMgSA9L/+rgaaWqs8S8yitOuWwZjtovE8T0glnCKf24bJ1ipbshbHw+2 HCqjdOtmiEQ+JYZZwELExmGDoDvW3FDThoJ6+tLCwbSVmAXey9f7AyBXXSyTPjQb XME1dcShMoDcWTJKWmh26zjLHVfc0TPNpKSsxJvGTvvPagy4z7Mts9A6etOdWbMK b8vo2pqhUE9Z9sWPcN7S1v1aqaPFlMjuTkrHe+vSdT5zHnSvMyEhCAbMjuBVVig7 c7eedEPT1DLgxp2opx/2ky1Z3Vbr4uM+r2whSPVI57pbwWmJtSXW9LiYcmPffk2w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrheekgdduvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucffohhmrghinhepph hoshhtghhrvghsqhhlrdhorhhgnecukfhppeduuddurddutddvrddukedtrddukeehnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrg gvlhesphgrqhhuihgvrhdrgiihii 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 4C20F3280063; Mon, 27 Apr 2020 03:49:49 -0400 (EDT) Date: Mon, 27 Apr 2020 16:49:45 +0900 From: Michael Paquier To: Jehan-Guillaume de Rorthais Cc: Tom Lane , 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: <20200427074945.GG11369@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> <25921.1587694875@sss.pgh.pa.us> <20200424034248.GL33034@paquier.xyz> <20200424150300.1b3b0c20@firost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bFsKbPszpzYNtEU6" Content-Disposition: inline In-Reply-To: <20200424150300.1b3b0c20@firost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --bFsKbPszpzYNtEU6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 24, 2020 at 03:03:00PM +0200, Jehan-Guillaume de Rorthais wrote: > I agree the three tests could be removed as they were not covering the bug we > were chasing. However, they might still be useful to detect futur non expected > behavior changes. If you agree with this, please, find in attachment a patch > proposal against HEAD that recreate these three tests **after** a waiting loop > on both standby1 and standby2. This waiting loop is inspired from the tests in > 9.5 -> 10. FWIW, I would prefer keeping all three tests as well. So.. I have spent more time on this problem and mereswin here is a very good sample because it failed all three tests: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mereswine&dt=2020-04-24%2006%3A03%3A53 For standby2, we get this failure: ok 11 - .ready file for WAL segment 000000010000000000000001 existing in backup is kept with archive_mode=always on standby not ok 12 - .ready file for WAL segment 000000010000000000000002 created with archive_mode=always on standby Then, looking at 020_archive_status_standby2.log, we have the following logs: 2020-04-24 02:08:32.032 PDT [9841:3] 020_archive_status.pl LOG: statement: CHECKPOINT [...] 2020-04-24 02:08:32.303 PDT [9821:7] LOG: restored log file "000000010000000000000002" from archive In this case, the test forced a checkpoint to test the segment recycling *before* the extra restored segment we'd like to work on was actually restored. So it looks like my initial feeling about the timing issue was right, and I am also able to reproduce the original set of failures by adding a manual sleep to delay restores of segments, like that for example: --- a/src/backend/access/transam/xlogarchive.c +++ b/src/backend/access/transam/xlogarchive.c @@ -74,6 +74,8 @@ RestoreArchivedFile(char *path, const char *xlogfname, if (recoveryRestoreCommand == NULL || strcmp(recoveryRestoreCommand, "") == 0) goto not_available; + pg_usleep(10 * 1000000); /* 10s */ + /* With your patch the problem does not show up anymore even with the delay added, so I would like to apply what you have sent and add back those tests. For now, I would just patch HEAD though as that's not worth the risk of destabilizing stable branches in the buildfarm. > $primary->poll_query_until('postgres', > q{SELECT archived_count FROM pg_stat_archiver}, '1') > - or die "Timed out while waiting for archiving to finish"; > + or die "Timed out while waiting for archiving to finish"; Some noise in the patch. This may have come from some unfinished business with pgindent. -- Michael --bFsKbPszpzYNtEU6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl6mjpkACgkQnvQgOdby QH3j8g//Se7McciQAtYMAFPBxNfsX62LFfeMkLxo/UyddPoTB1U9vhQsMNyeyrLL +zJF8ff9qujkVxbjioFwkb+n0DwhyHOtCw5mNsuh+Crixlr6AVkscC0fU8fUECW6 w5x/RbvsDUsMrsz16fRqRKWRqf3g2cJThUHqpjW/L60aqzdrshhxF0om8sJAFKRK cWeqGE6uyxszmvaEuZFyihcsuwt1g4adHIn/HSqgrmXkLrw5nbVA0GQ3o81Hd8Nl lW0exii4wA5LGb2SWGPsyeJkjHuPbCvHXlL8hktks0UqGlHwQUwp7EHFTXku3oJM pbAd1xSYg0EUmCJZGnQyI6mZ8WhysbemSpBE3mab8FUfado6uDibERJlafIY+HtZ 1SJr1qVkbdHDXltQHr4lJJ9GOBF9Ls+ot2aivcWknqcYG2L0FZ2ohO8y2tmCoCDg g6T26EVqHboGKLGOP99ZTS1VrUE0O40NBJqm6cNu5NvgUSeEjtNUirG2nxXZTzjo 6j6KbBUNVi1x7/2iLMRu6ODneW2GiFS4qUpmWQ8H/OM+O4NM8OhbVkXsrU79GHjV MqE5yvRg9bIBomht6KpnSlub4VazVNrobQVVjG36n01XjyE/vrBJhTauYAtirnJB ytsp0QSqqLw0JVgij2SwXeJjFCWN7zdbLJ+5wxUH7H5ptP0y1s8= =zh72 -----END PGP SIGNATURE----- --bFsKbPszpzYNtEU6--