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 1wd1fq-003phY-1s for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jun 2026 08:12:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wd1fn-009tEo-1B for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jun 2026 08:12:27 +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 1wd1fm-009tEg-1u for pgsql-hackers@lists.postgresql.org; Fri, 26 Jun 2026 08:12:27 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wd1fj-00000000J9L-3kU1 for pgsql-hackers@lists.postgresql.org; Fri, 26 Jun 2026 08:12:25 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3E979140003D; Fri, 26 Jun 2026 04:12:22 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Fri, 26 Jun 2026 04:12:22 -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=1782461542; x=1782547942; bh=DS34s8AfUL b2Hz7hdb8NZCZ09xYB/kl4uGtw9iieC90=; b=T8GaUZrvu4e7DS0ws9LD4tpHMM 41nzLeQLCQjf+kOuAQtI9REs3fLhNMANf/ZwC7VRaCSvXbCNN4bAXVOcDiZN3w8g vncsqhAslZE8yYz6AsdiS719AbWPdDK8dqnyLG7vEhkCLqH30HPAWF+G7/5ZX6Lu ADtRhn6zci/sUC0JQ96H+5k32Cj4rYk/g39XkrOTt2EVrvnzOgPnWZB5sgkLgOR/ 4Q5J5/zWFweGl6zrcWB/6TXfZBiFp1Pio3mNfTFGIFOoxPfzF/RcSBw7sx4FAIPT xAmrSk433PQZwkM+NC/bxKWid2WcdNDZxqHXv94pAGoOevo94N4dAofF6f1A== 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= 1782461542; x=1782547942; bh=DS34s8AfULb2Hz7hdb8NZCZ09xYB/kl4uGt w9iieC90=; b=kMpklkvcPbA94W0eR+2Lmjwwr7L7iqqayLjhaR+Je+YOG+GcCLd 7kk1Yrw004LsulbzAi9leQWtD3A53EJsIcgjoMt5Z/FBw9c3iRE5DGXX8gW9WamD Om9A7nnfCUvDCyVadJUf+DGqGoi5ojzd1E8QRHFfr3bVfTFMirvmM4wj7psONIyj 7UiJgFd/6NxdiSh5hcW+uz3olnf7KUeBY87Xphv+wsCg6l7rTlIvus3Lu0QPD5vL iztAiYTlVgVsJcOA+fJMk6GzQ9bWQENCyyvPz/AncGFx+cyBm3Ug5qsJMZYzUwPo wGQNQOCP1VwMNlTptCdpaejXKgguL1Tk7PA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTE50r5+DSoz43VhjZywXDbyCgXhlVFk0BhedVi7QJzx9GQ1ZDLEugLdqPjISSyV1n EsAXGlz0hLqjRyZyEB8zSUVGf24bBGtSO9lK4nIq2NRij7j2n8vEcMVhl5GOzQvqZHUNfZ yLzJxZt8AxQXSM4mTH9KenQiu42UYox9xixhLOrdiwKRrJ5sjln0kGlAbTBf82mB+t9e01 6+3sKEo9Hm09suBVRo7PLAWJSwq4Vu2pLXNzNBTQuaGFHWcG6wNoIEfntzEmm1w98bdhY5 Ee9g/feQxj91rAHLvY21YvPUxIZACIwVAaJAhlOP45EgcunKN6m14JgoA4I+PZZq9GMol0 r4HAQ7K6ROTikyXFKCV+H08/cB39os5+uA8ZeU526GUuwPTVIDWaN7qoWWsqkvOkQdPWlj hyXQgZojUJqfi2TqvAQT2U70HSCAVZaDo73192ZhrBPlbfF7FBgalu6WUjJrljZjaOZm9X xQqbBNs3EonC2nzpU/kKg6D1rYti9Brz4xWNmVFxDcP4Ahr3ZKSmoOB7QNe8V5OTFxJ2wr isXzQQVI9a4LUvrMTq5RKQP5Qtg4TyB5bfeFevA63TcdBFWOckhuUlxKc6faSCxwWQN0+k B8CYQ0RUBeDPbXz3O3F0Cv+dWSby8jX5lxB6GiqM0lJnMr9DC9HgajpySWZw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 Jun 2026 04:12:19 -0400 (EDT) Date: Fri, 26 Jun 2026 17:12:15 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: sjh910805@gmail.com, alvherre@kurilemu.de, scott@scottray.io, masao.fujii@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Don't call ereport(ERROR) from recovery target GUC assign hooks Message-ID: References: <20260626.161553.236415645647775260.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3DCYKRVakMQELXPE" Content-Disposition: inline In-Reply-To: <20260626.161553.236415645647775260.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --3DCYKRVakMQELXPE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 26, 2026 at 04:15:53PM +0900, Kyotaro Horiguchi wrote: > As far as I can tell, the existing recovery target variables already > seem sufficient to determine whether each target is configured. The > only exception appears to be recovery_target =3D 'immediate', which > would probably need an additional boolean flag (or similar state) to > represent whether it has been specified. >=20 > Then validateRecoveryParameters() could determine which recovery > target is configured by inspecting those variables directly, report an > error if more than one target is set, and reconstruct the same > recoveryTarget state that the current code expects. And delay setting recoveryTarget at all until we enter the validation step in the startup process? We don't use it in any of the early steps before entering validateRecoveryParameters() (if we do so, that would be an incorrect thing to do anyway). I don't see on top of my mind why that would not work, skipping all the RECOVERY_TARGET_UNSET manipulations in the assign hooks. One source of the confusion, to me, is that we have taken the decision to link directly recoveryTarget with the result of the GUC, while recoveryTarget is also used to track if the other target GUCs are set. It looks to me that we shouldn't use recoveryTarget to track both if a target is set and if the immediate state is set, and split both things. This is what I guess you are getting at with your extra boolean. Let's call it a new recoveryTargetImmediate. At the end recoveryTarget should never be touched in any of the GUC hooks, just once we enter validateRecoveryParameters(). -- Michael --3DCYKRVakMQELXPE Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmo+NF8ACgkQnvQgOdby QH1LMQ/7BAnV91tuWc2BvMNJP6ubjUcHqVC9Zvv68SggwyAyQhIgRuOzgngC8OXx NQCBbze9ikX5/f2cfRckIJhuq6MsGRF4DOT84gEMeNv3zUF4d8yjGj8iCGTwG26f ywURByT1YvGD+cB6Ogjpnt/BHL8vkCgOAYB+NAmXuH23p8/p8DogeEs5/eFIsgop dBAaWkG1Qr+Hf3Gt2EwqVq1yfWiEioR0f46zqBcIrymnwk4WqZgnoeYInVGLIToF H7pQZCGlz5E6kVoGm4kYZQaxCd3X/sKofCvyShMo1i+2uzgxFVgYfvlbthpjemnT Dsamvp7807Id694yLxC/4p/RfrzolT1ghyyR+TeQKnDF4q+8La383ZOwwmhdkboO WKlMUdDM9mYSZAr83gsVv26lW+7hYcTa7TQfxEnnPSlHZzgQdJkh4RkhanoG8XQ2 5iaB8Vlr0HhgmR64LpIMkBSc3VnFWA5H/hUmfZeROHkUkj7NqlavRLDvXTxjjKQf uSc9m47Fx+aVvzJtGurFCZ5djsEeeDmrz+BKg5lGlp2/oYcJNx6IS7PpSEYYIj7c /C+h/Cnx+kJfiidpASmDEbNUR9Fw3AuPSUQsVOtnzDcGkpmGjnPWHXp5jvfKu6at 9EwZAakh3gUEhhhsu7a/TLxry4H/o7k+DmD2c3P4lY9gzLGXO+M= =cwet -----END PGP SIGNATURE----- --3DCYKRVakMQELXPE--