Re: Improve checks for GUC recovery_target_xid
David Steele <david@pgbackrest.org>
From: David Steele <david@pgbackrest.org>
To: Fujii Masao <masao.fujii@gmail.com>, Hüseyin Demir <huseyin.d3r@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-04T05:11:48Z
Lists: pgsql-hackers
On 2/27/26 08:12, Fujii Masao wrote:
> On Fri, Feb 20, 2026 at 2:42 PM David Steele <david@pgbackrest.org> 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 = (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?
Regards
-David
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Improve tests for recovery_target_timeline GUC.
- 2007df43332b 19 (unreleased) landed
-
Improve validation of recovery_target_xid GUC values.
- bffd7130e942 19 (unreleased) landed