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 1vxoLe-00HA3a-1X for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 15:41:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxoLc-00DMcA-2L for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Mar 2026 15:41:17 +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 1vxoLc-00DMc1-1Q for pgsql-hackers@lists.postgresql.org; Wed, 04 Mar 2026 15:41:16 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vxoLb-00000000OUn-0Sj8 for pgsql-hackers@postgresql.org; Wed, 04 Mar 2026 15:41:16 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-677a11d11e0so2814714eaf.2 for ; Wed, 04 Mar 2026 07:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772638874; cv=none; d=google.com; s=arc-20240605; b=HH81t1r0reyY/bR99cQedOxVZTKudenclwrg/si/VOs2wxMHPvVmf21ZchJYwPJ5SZ 9yJSgTwzVuTYe4RGke6b1YSWwb2NTRC3Cdt6VLiO44n6tjcaPeP31qOGTabfihcSbn5F 3EuO7/8LBDhojjOQHczd0sBdgXiP1+YZiWgzZxUT5pUSkQMCiusX9SiuBgkZ/2CWDeoO tMcGzOgZKZ894T+QvQejMACTmZ6rB1Try7UewQETkQcXWpmA8wrXvvN23PZCVQpWvpRE +HP9gKzLqQFWemimKeXcvrf9t76IgXAYcI9/nj8Te938eCZtBznSiBYFjU3MgjjBAE5I CCQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Bk0lH+yqQsUFbxOMPnBIy3tH7G9JwBnAxsuVGKIHOKg=; fh=TFEm2D/6ON6Oz7A4tvSeotVwMYQ6QIHBm+AYzFKrHbs=; b=YRGFfVxIYvTYKAaqqOVoDpXNVHLQV8WYgZuHXb4v3hvSBh/W9nkx9Vj29rblqKCjrh cPrlzyvec2Y7/KJjNW+BdJPh4514ZIMnJCm3HjruST/4WF39QdeHmR/SBYCQ3fmYlNg8 YI2aXty2bIW0N92QrvMfv8hncagvcEvVcSQO8YeL+IhR1axKg29Iy8LfgRIq9BzBntY+ F6YfZYzCEBdfsYnfGrME2A0fplgSHEV6cLAH5MztkvcZMl+O4OA0Uurvls8zwf0T10uE GeJqAyY/t9tNP79QiVH+G+GHTpd7GGi/mN3Y9cqHkKPv4fCRE+sINrTsy5aTpin/whdM WDNw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772638874; x=1773243674; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Bk0lH+yqQsUFbxOMPnBIy3tH7G9JwBnAxsuVGKIHOKg=; b=Gtf7lruy01VlrLjFaFtnT8a4Q2IXIOuTflBkoY4MUOrvK162pJE+HkqPBf12G3dXxg Ityg2xEEbQBt4VzPdVbfh/wEOIyGV9qF7q9pJNP6xAcbws+286AyYOJdyqNY4JTw61v0 +leaTyorh9gXmONZG3P9TodTLb6yOe7WNyKnEsgtS7AT9Jlin3OUQkzy2hn+WtszB3TE mmPAxgLsgmoc82gFNE+gPhhxcblbAi0ozoeWCLF8+6jiRCIpc/X4EebWJKpNQFabXQs9 IYhpSHmy0bFch0P3PVc7UC2z7wdHJc01fd/WYfK2tyyAKmTbGIF1vSS7g/wDj6mgXtgE +wUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772638874; x=1773243674; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Bk0lH+yqQsUFbxOMPnBIy3tH7G9JwBnAxsuVGKIHOKg=; b=JfOINuVWh1+rzmWiqfv7G31cooti711R4YwcxLfKEpFbdvp4LZ0rqzYEp5soxRajVm Zg9FudIT77Wj/KaZFsDkmb3X8886xVbMW/EUSPvFo+3CjpWWw0Hz+C5q4mq0bTjAvnfq QkGkFWbf4ARUTXmsy2pFSCYJTmqR7Bsgh/ErPoiboHk4466qfcVqJRaCw0MgZZk2RBgZ 6IzfU9fL//2J1Dg1A0zVnTWCd3UIut1YLlbmJ34TMiiFE5Ig/p1qCjoLm2R9hm8O8KN4 2ELxj9q5eYXtkUVVGoRXiwZb1Ailtxq6t5jDQU//FtRdk6vMtLl2KGs/iCg3CNDOsqfb EUyg== X-Forwarded-Encrypted: i=1; AJvYcCWeUCUlBlhB5Yyz5BtK1sYx4gAkBhyP4H83Imk1Ru8lZJ0iZLqR/LdGNNILK1R1LoenHxNQxZLb24ifS7LP@postgresql.org X-Gm-Message-State: AOJu0Yy120j77YCere2nB8sCcsLW4IqsKBrXe/RSmsxoL1MRyqR7qCT0 bckPN2Lfl1E4o8ETMd6T5+GbXDGiR/WAQC5kztvkKrZk5OB1QQRuYAfk93eSvfeYbDxqccBNL63 pK4x6rkKd0ScYfGEi7CcHvBU91878cEs= X-Gm-Gg: ATEYQzxv9xzL2zRvRts2eOwLbwzcZh2KNa9FI9rnbmHD1reaoMiryq9VQF+WnTm6QSx 21XfubNM5Ekr+ZCw8cq7+GXUeG2DNyIq/gXLMj2BdVSohviUoBKcldCtqIF9MDOPbcg5N0AzVYr cNwFtFaJGvs0JIa3F9Qh8jhva3L8x9V/1/Czz//4dxAeBvABYJl+om7AWFzuJ3kq+dvqAiWFNQs yPOsdfqwhrx4sJQ+UaGZcaIshv6xBGGLToK6sRK4VA8sfbULeOQFboc6DpJ6oCEeTTeOZgPGbzp 4mS7Ux7OxH1Z4eAebqgsl9tJZRelU9CrkK5aldR4pQ== X-Received: by 2002:a05:6820:f024:b0:676:f8f6:3f67 with SMTP id 006d021491bc7-67b1e902872mr1142752eaf.59.1772638874377; Wed, 04 Mar 2026 07:41:14 -0800 (PST) MIME-Version: 1.0 References: <9e8b7ee9-4a16-477a-baa5-0cdf37a04798@pgbackrest.org> In-Reply-To: <9e8b7ee9-4a16-477a-baa5-0cdf37a04798@pgbackrest.org> From: Fujii Masao Date: Thu, 5 Mar 2026 00:41:01 +0900 X-Gm-Features: AaiRm50M_pcIL3NzjmvrojiF10D5tJvvtrMB4GJOuBcpRdZCHU7TORphDbsUUrU Message-ID: Subject: Re: Improve checks for GUC recovery_target_xid To: David Steele Cc: =?UTF-8?Q?H=C3=BCseyin_Demir?= , Pg Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 4, 2026 at 2:11=E2=80=AFPM David Steele = wrote: > > On 2/27/26 08:12, Fujii Masao wrote: > > On Fri, Feb 20, 2026 at 2:42=E2=80=AFPM David Steele wrote: > > > > + GUC_check_errdetail("\"%s\" without epoch must greater than or equal = to %u.", > > > > "must greater" shiould be "must be greater"? > > Fixed in v2 attached to the prior email. > > > "without epoch" seems not necessary to me. > > I guess that depends on whether or not we error if the epoch is present, > see below. > > > + /* > > + * This cast will remove the epoch, if any > > + */ > > + xid =3D (TransactionId) strtou64(*newval, &endp, 0); > > > > Would it be better to use strtouint32_strict() instead of strtou64()? > > That would allow us to detect invalid XID values larger than 2^32 and > > report an error, similar to what pg_resetwal -x does. > > This was my first instinct, but it causes our integration tests to fail > because pg_current_xact_id() returns the xid with epoch. You can fix > this by casting pg_current_xact_id()::xid but this seems like a pretty > big change in usage. I'm OK with it but we'd definitely need to update > the documentation to match. > > What do you think? I see your point, and I'm fine with the patch. My earlier comment was based on my misunderstanding. I thought that only 32-bit transaction IDs were allowed for recovery_target_xid, and therefore values larger than 2^32 should be rejected. However, recovery_target_xid currently accepts both 32-bit XIDs and 64-bit full transaction IDs (epoch + 32-bit XID). When a 64-bit value is specified= , only the 32-bit XID portion is used as the recovery target. Given this behavior, your change seems to make sense. Regarding the regression test, if the purpose is to verify the GUC hook for recovery_target_xid, it might be simpler to test whether "ALTER SYSTEM SET recovery_target_xid TO ..." succeeds or fails as expected as follows, rather than starting the server with that setting. That said, since recovery_target_timeline is already tested in a similar way, I unders= tand why you followed the same pattern here. So I'm ok with the current approach= . my ($result, $stdout, $stderr) =3D $node_primary->psql('postgres', "ALTER SYSTEM SET recovery_target_xid TO 'bogus'"); like( $stderr, qr/is not a valid number/, "invalid recovery_target_xid (bogus value)"); If we think it's better to use ALTER SYSTEM SET for testing invalid recovery_target_xxx settings to keep the regression tests simpler, we can revisit this later and address it in a separate patch. Regards, --=20 Fujii Masao