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.94.2) (envelope-from ) id 1t7qCL-000hD2-96 for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 06:04:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t7qCI-003QVP-7h for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Nov 2024 06:04:18 +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.94.2) (envelope-from ) id 1t7qCH-003QVH-Pu for pgsql-hackers@lists.postgresql.org; Mon, 04 Nov 2024 06:04:18 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t7qCF-0004iN-PR for pgsql-hackers@postgresql.org; Mon, 04 Nov 2024 06:04:17 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id A022711400C4; Mon, 4 Nov 2024 01:04:14 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 04 Nov 2024 01:04:14 -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=fm3; t=1730700254; x=1730786654; bh=kFaUoJNuGk qtJddprG8NgcWd+nBRVRLCHCVynLv3rIQ=; b=c7167AEckBkdh/ZgpUxr7Ufvkx vPD3kgXHeJEFr4z4d9a2hTo29S3mNDOygfjq8CN6icJneqB42NcJmJ8aRpL23D+8 fGZjqG+UeM/NeX/s7pQb0cNWq2lI0ncZKp0nl5UpwWp8WrjfA711IHsPnSVuzP40 rhfYz7eW2kQAQpuZOm14jHRrv9D+pdfs5VNOMFPhWKSjqFBCUGn5VznDSHAW2FmR bfC9Pj+AsssONJYloCPE4rsIj+56Ait9TAYly6gyf/fb0hQAEXnln0Zpzvh/8Bfu DylLtxYAlZ0/TTYBYDHxobRKBDoCAQqKKaNGhGMk9pT040dSteAC6e+U0cIA== 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=fm3; t= 1730700254; x=1730786654; bh=kFaUoJNuGkqtJddprG8NgcWd+nBRVRLCHCV ynLv3rIQ=; b=niYHNTMnNkKYyHmrcAMi8xVkQoUOL6y8DGdkQmGmqCN2uakNkhJ dbnBlUfvzYCqe2jAkk4NFAQkZy+9/BbW2DL5d0gMaUYVw16uJRHYIt63b1WOpKl7 kX4neYqJRCW533irE5tmbqbLoETyhUBqgDm7LtLRZyc4592t2D+h/M4/QBgOTti0 ZXpa3a896NfhYEXW+gaK8ZSZyD0yuvu7htEIXSb9oDbOFi7//1jxjBwioMwENiqI C5w/4HO1Ooaz7xMlyb5HnbZyNqRsCPS0xd42wkGSCk7/1TcdDoPMW1qSdi3RtzMF ac2YlIR0yQp/ufOr/nSQbJ/lbqKBTu/F6qw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdelhedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtoheprggvkhhorhhothhkohhvsehgmhgrihhlrdgtohhmpdhrtghpthht ohephhhlihhnnhgrkhgrsehikhhirdhfihdprhgtphhtthhopehprghshhhkihhnrdgvlh hfvgesghhmrghilhdrtghomhdprhgtphhtthhopehpvghtvghrsegvihhsvghnthhrrghu thdrohhrghdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgvsh hqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Nov 2024 01:04:12 -0500 (EST) Date: Mon, 4 Nov 2024 15:04:09 +0900 From: Michael Paquier To: Alexander Korotkov Cc: Heikki Linnakangas , Pavel Borisov , Peter Eisentraut , pgsql-hackers Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure Message-ID: References: <14de8671-e328-4c3e-b136-664f6f13a39f@iki.fi> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="29jdUWkjKlCSYaWU" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --29jdUWkjKlCSYaWU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 04, 2024 at 06:29:42AM +0200, Alexander Korotkov wrote: > The attached patchset contains patch 0001, which improves handling of > not in recovery state by usage of PromoteIsTriggered(). When > (PromoteIsTriggered() =3D=3D false), last replay LSN is not accepted and > not reported in errdetail(). >=20 > 0002 contains patch finishing implicit transaction in default > isolation level REPEATABLE READ or higher with revised commit message. I was just catching up with this thread, and I'm still confused about the state of things. There are two things that are out of order for me, at least, after skimming through the code on HEAD (I suspect there is more): - WaitForLSNReplay() uses an initial set of checks that are duplicated in the main loop. This is still overcomplicated, no? Wouldn't it be simpler to eliminate the first of checks or just have a goto block with addLSNWaiter() called after the first round of checks? - pg_wal_replay_wait_status() returns a status based on a static variable that can only be accessed with the same backend as the one that has called the wait function. That's.. Err.. Unfriendly. Why being sticky with one backend for the job? Using output parameters in a procedure is something I did not recall. Based on your point about not using a function due your argument based on the snapshots, let's just use that and forget about the status function entirely (please?). Based on the latest set of issues reported, it does not feel like this is really baked and ready for prime day, either. Perhaps it would be less confusing to just revert the whole and repost a more complete and structured implementation with an extra round of reviews? There's still time in this release cycle. -- Michael --29jdUWkjKlCSYaWU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmcoY9kACgkQnvQgOdby QH1cTw//Y9VSp2g0m+7L8AvC4caOb4S/ruDV4/qkuEo1Ga4VaDUt/N2xGknbln7p YQumioebdBce4rSbXbL33vwD1/melC/cMkWzlWOCaIP4dWy0eheIDkZcVeA33Ww9 zQQTNpwWiSICA5crp+Nzz+Y6hwJVkz7w2FPgZ1kDgw0h4BxXvUx58xqNhNfMp4NL j3D5XFG7wtrfq6xFBwV6YNhtyH8UGJVKeLcNjPy6JZ97+jL9eiHXZvqoZGeKxZYx vS7kON+Jqg3wrIi4A663oMjtn7q+gMKDDg/h5mY457ATkoB/FriqrECWLofu2SCS tne+iBQzlF202kv+fURkicwOh34TDkS+eUtwyGzGNc2mdB25/k0fyQgMCEHe3QJp 20OTuhwDz9LeY1DhdW6/u8dfZ88AotaSC9CxnqrrF3KRzUCYPECs46DM7n1gqsxs vwIXOqW77ixH+3gTjZMAFGhy2TUQgZorGiTUB4cupip+R5iH/gpF9GRpRLA0IB7s qZ9ojagLSAlsqI1UEhT1ULu4uv7pgyiIqsgBtvTH91P9I75VKrC+eTozpxmxW+i3 ObjFwtRLwvB7thg3tClnKBO6Cwndo0QmHUDB4hLIuofKYhOmFQ8SBq6XPlhvjI5E C/gYdjQBlebuckVSaVPi6i530hHBXWqzuRpvn+YxoqJ6JbNBNvM= =eDN4 -----END PGP SIGNATURE----- --29jdUWkjKlCSYaWU--