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 1skusa-003lzA-PE for pgsql-committers@arkaria.postgresql.org; Mon, 02 Sep 2024 00:25:13 +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 1skusZ-004Xuw-A0 for pgsql-committers@arkaria.postgresql.org; Mon, 02 Sep 2024 00:25:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1skusZ-004Xuo-2U for pgsql-committers@lists.postgresql.org; Mon, 02 Sep 2024 00:25:11 +0000 Received: from fout6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1skusW-000D5r-M7 for pgsql-committers@lists.postgresql.org; Mon, 02 Sep 2024 00:25:10 +0000 Received: from phl-compute-05.internal (phl-compute-05.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 431591380283; Sun, 1 Sep 2024 20:25:07 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Sun, 01 Sep 2024 20:25:07 -0400 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=1725236707; x=1725323107; bh=4QLdorVeeW N0Etg9hxS7QFD1OAZYTJ+WhMdCOwjAHi4=; b=L2N2XJOzRSuMssR19ikx30hyyJ 9FILdR8J1treEX/T6plPFf5gLD0Q6DjXDeUKEsJxfR82DFtXk29CTNnbW1uhhabe eMqVJDPGKTn2+2rM/rB4qP+eiysf4wv1PX4kNL+iSEDHyEd7cl7gptda3l4cvHTV s2lzfmslOzQHRIzdyVDlU2M2VwRCYH7ST0KbXyH1Sk7J0VgoR3OKXVqFXlahqPhu j2K7/PuvzAIWq+W+f3S7BcZS/aL9laIlC56hKGJRTB2fKgPSzJxKqdTd446eN4Hw 7j4wAX4wnnLxRAYmYQFgwQPBwLPDc+AgbjG05P59ly33wHjPBL2hmOTAEMwg== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1725236707; x=1725323107; bh=4QLdorVeeWN0Etg9hxS7QFD1OAZY TJ+WhMdCOwjAHi4=; b=YSjfRJyTnkMxhvNiONq8uZkhTXVDg2XIgPTKZD3uS0ar aRK/o8YRpl49JS/rsEBs4pp0urH9B3hU07c6olg872nQaEZf2M6nHOZOBXDNqXYr EZhLWM8KV3eMQsW1Akcm+27F91IYp0z+Tqo9FCjyN+ZoVPVxRN/LBlekK1ZIprbf sSDlcjwtL1R47vkSpqhPuA4NdZN/piIzeQRwM83YRBWzsZ6OEe/RuCcFvO/yyNdF CfH9FMjJHTHzYuA6vXkOqRFFfmWWcWeG2Xdqdsx2ANl0B44O26zsJwW0gXn/BZeG GYZ/tr7nPUW15AiqYqHJcc4k2A6qckduy9KSeEKDNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudegledgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtoheprggvkhhorhhothhkohhvsehgmhgrihhlrdgtohhmpdhrtghpthht ohepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtoheprghkohhroh htkhhovhesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepphhgshhqlhdqtgho mhhmihhtthgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 1 Sep 2024 20:25:05 -0400 (EDT) Date: Mon, 2 Sep 2024 09:24:55 +0900 From: Michael Paquier To: Alexander Korotkov Cc: Peter Eisentraut , Alexander Korotkov , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Implement pg_wal_replay_wait() stored procedure Message-ID: References: <18c0fa64-0475-415e-a1bd-665d922c5201@eisentraut.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HFMY63oezjKouoNS" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --HFMY63oezjKouoNS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 02, 2024 at 02:55:50AM +0300, Alexander Korotkov wrote: > Could you, please, check the attached patch? The patch moving the code looks correct at quick glance. Now, I've been staring at this line, wondering why this is required while WaitForLSNReplay() does not return any status: + (void) WaitForLSNReplay(target_lsn, timeout); And this makes me question whether you have the right semantics regarding the SQL function itself. Could it be more useful for WaitForLSNReplay() to report an enum state that tells you the reason why a wait may not have happened with a text or a tuple returned by the function? There are quite a few reasons why a wait may or may not happen:=20 - Recovery has ended, target LSN has been reached. - We're not in recovery anymore. Is an error the most useful thing here actually? - Timeout may have been reached, where an error is also generated. ERRCODE_QUERY_CANCELED is not a correct error state. - Perhaps more of these in the future? My point is: this is a feature that can be used for monitoring as far as I know, still it does not stick as a feature that could be most useful for such applications. Wouldn't it be more useful for client applications to deal with a state returned by the SQL function rather than having to parse error strings to know what happened? What is returned by pg_wal_replay_wal() reflects on the design of WaitForLSNReplay() itself. -- Michael --HFMY63oezjKouoNS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmbVBdcACgkQnvQgOdby QH2huhAAo5k/j3M2Gu10rAl0gq8Y/U3njx48/bW3zdHsSQG4tyz7BkR3ciTPpVii y0e3C77MxK4mTZBhd880mMNP2TNkU1V3WBW3mD3Ytpaw2eIh2gQdgGwu8HSoCNKt 6hSot4+a22DLBPeoHiazrpg1FRedalTRdQPGT5eomysAiP4sMxh2edx3uF2FUZNd e1d2H+VtUS6NznXoTccnva4Q9b+oLazrASFWmuWJtLSboYFWuNnJSfOb+k9oTEWv QXMP/MZn+J0v3+QlD6PIfxTQNwkiKi+edAbejLLeB/AcXrDEfo7CUalgMacl44cI kaeeTZmuXg2wGMOcBenhu/o7PHG47wlME1/nyk0+UEn27SAGSxqpsErkhn0dM5Ro juP4qJmTWdSBnhZE6Y5DrA3wfL6bRof4OsIFNqLzI/Fqw0cnLIEnWgIgmjSECfDj RtLOTqbGocT19pnrj96WijdhhaLM0AOCds5xGZE89sO1kJE9Cmaov/SD5JH0sBrj iVJvr3eKGUIYWFiL5tqiguwdsAyOaEihXBGjU3m47w/kdgf2VDjGmKJLs1uq20/X l6DVVBg5OcwH4GFrgZ5mmHirvmuTwiLom+0lY+/oqNt9kIJwIsAp6FYf7+PqK4AP PUiyxw2BY6ideKCxGjwGBMntsFXgmaKzLpzBsaG36UWLg4dd9eE= =nYhr -----END PGP SIGNATURE----- --HFMY63oezjKouoNS--