Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vxepg-00H0lu-2U for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 05:31:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxepe-00AOVJ-1H for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 05:31:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vxepd-00AOVA-27 for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 05:31:38 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vxepc-00000000Joz-0aCV for pgsql-hackers@postgresql.org; Wed, 04 Mar 2026 05:31:37 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id BE951EC0581; Wed, 4 Mar 2026 00:31:34 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Wed, 04 Mar 2026 00:31:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1772602294; x=1772688694; bh=to/Ab9sJZH j5KajWNV+fXUEFSaSAsc7lu4NhRs6Pmoc=; b=WNQXWE3nRUf6ynoJEMfsHw8pyJ 7lkMDKAhBVWNtQJrgbeepRK9jAF3WenIdL9q/i9EvqqPmXEbL6fkoXbIaSOvsn9/ wZw4TKeHhrahKXBNnflhcRJ9p+QY4i3xm/rAC4l42zerh4gn+vHIGSpSdAf8pov/ pJEa7IzSPxMbdMZrBE6jAzQZdq878B6fxLOKijExg7JvNtlvdGyp8YbV+Lir1HqR AOfzk0HkfJZe67DecHnW3rZCvX6wzyGTj4E/OToph0p9ZagL02XZLYVXCgJaO//f 6Fy5wYbfGKVicbTRFLviRpLEaKc0wD3pa1j6U6TghBkQD48f2xU2LdvSh2uw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1772602294; x=1772688694; bh=to/Ab9sJZHj5KajWNV+fXUEFSaSAsc7lu4N hRs6Pmoc=; b=Wi89B7Xd9VFugr47WEJtp3UDDIuSxJxKmX8BbL+gLJYNmnNQFIO 1NiOD6LpmGsU7qBUMhOuTjQy3VmfYdFntK5yrlUa8pqk6P131e6rvBk7Bs+Q7kup WTqmhz4vmrJeVY9KRRcr4MN9SDUWIQETrffM9E+W7+ecXtRds4d+eK3+pRl2NOth nNYUqv11f4pGpGKlKMneGEfKFpfQqkwZGI0xVanown6dWHmN6lCTlou/UKQsfH/S sWqcyxNYAXoIXliwaXkOk7dgOYt9So+0gP0gsS4URaSd6h0rMsjbjqbi1TwnLPjW dWeDgm2BlxVtmnFTmurTl8mDr3fOZIJOk3Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddviedvieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepkhhurh houggrrdhhrgihrghtohesfhhujhhithhsuhdrtghomhdprhgtphhtthhopegvgigtlhhu shhiohhnsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsh esphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtoheprghlvghkshgrnhguvghrseht ihhmvghstggrlhgvrdgtohhm X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Mar 2026 00:31:33 -0500 (EST) Date: Wed, 4 Mar 2026 14:31:29 +0900 From: Michael Paquier To: "Hayato Kuroda (Fujitsu)" Cc: 'Alexander Lakhin' , pgsql-hackers , Aleksander Alekseev Subject: Re: BUG: Former primary node might stuck when started as a standby Message-ID: References: <63e55743-669e-4300-a561-7b7ff63723b6@gmail.com> <045cab6f-4738-417e-b551-01adba44d6c3@gmail.com> <493401a8-063f-436a-8287-a235d9e065fc@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FzwtQK2CywyNT3kv" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --FzwtQK2CywyNT3kv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 03, 2026 at 09:17:16AM +0000, Hayato Kuroda (Fujitsu) wrote: > Thanks for the info. So I can provide the patch after the issue for 009_t= wophase.pl > is fixed. For better understanding we may be able to fork new > thread. Regarding your posted v4, I am actually not convinced that there is a need for injection points and disabling standby snapshots, for the three sequences of tests proposed. While the first wait_for_replay_catchup() can be useful before the teardown_node() of the primary in the "Check that prepared transactions can be committed on promoted standby" sequence, it still has a limited impact. It looks like we could have other parasite records as well, depending on how slowly the primary is stopped? I think that we should switch to a plain stop() of the primary, the test wants to check that prepared transactions can be committed on a standby. Stopping the primary abruptly does not matter for this sequence. For the second wait_for_replay_catchup(), after the PREPARE of xact_009_11. I may be missing something but in how does it change things? A plain stop() of the primary means that it would have received all the WAL records from the primary on disk in its pg_wal, no? Upon restart, it should replay everything it finds in pg_wal/. I don't see a change required here. For the third wait_for_replay_catchup(), after the PREPARE of xact_009_12, same dance. The primary is cleanly stopped first. All the WAL records of the primary should have been flushed to the standby. As a whole, it looks like we should just switch the teardown() call to a stop() call in the first test with xact_009_10, backpatch it, and call it a day. No need for injection points and no need for GUC tweaks. I have not looked at 004_timeline_switch yet. > I guess so. cluster::stop does the `pg_ctl stop -m fast` command. In this= case > the walsender waits till there are nothing to be sent, see WalSndLoop(). > Do let me know if you have observed the similar failure here. Exactly. Doing a clean stop of the primary offers a strong guarantee here. We are sure that the standby will have received all the records =66rom the primary. Timeline forking is an impossible thing in 012_subtransactions.pl based on how the switchover from the primary to the standby happens. I don't see a need for tweaking this test at all. Or perhaps you did see a failure of some kind in this test, Alexander? -- Michael --FzwtQK2CywyNT3kv Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmmnw7EACgkQnvQgOdby QH0QRQ/7BZrIP+nRAIEHVVUnqNYEWRIknHaFA4uC3uVbO56WWyDuRTyIHPKfYV/P y0E9ot8jhx7aPaTMSHbPAgX/rhF3ohszCoMljPqeqs1wNRtc+Cot4Aqcc0G9HE4E yj1NqGAM6eTUF07a0tQIGm65cmMu1D0rM1rA1ZSP9PwTGJAeykHTtXfBIRLZVdoF rfQjZrpvMVVdPqIu3H7uug/kPQJpjbrmMnvKq5A3RunT6O++XkfT8mMqprlVZQ2A CoeAvP1UorKYE9xJ56pofIYbBsokiSmSiG/nU8GXlX7fHN2OCvUDjIrYWkkuDByK qMtOR0zdLZ/vKDAa5aR8QtSOiheeQ2Jl0odAlqHcoLpuHx+64sesitaRMCiGPIJV GM3ZCT4t9agIpUpu0sJF+LV0+xMg7rodNPv+8xCNNWqeYZbOIjGdoungQowEc5bO ionL6HYDpJzxYKeoj/PwJZjx+XzwDbNbITbZEOIze3zLq8ihQiDG3jL3JWuPLj/X PKGzfGwEMqHU2WHy5IjKwdXFXIp9d/kNXM4aJq0Az6ZwWbe9ha6e0FHT4irs+ooU MCa4SvBBus6b7o3KVlcncrxphxQ10sbSDt0ijH92+IrwDN+nBVTqtCL9ospDnK8s r+bY+KvD3R+pyWcagEYKkzcjJZzYhXcn4fFw6UtRPqZs0BKtbws= =Seu7 -----END PGP SIGNATURE----- --FzwtQK2CywyNT3kv--