Re: Improve checks for GUC recovery_target_xid

From: Hüseyin Demir <huseyin(dot)d3r(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: David Steele <david(at)pgbackrest(dot)org>
Subject: Re: Improve checks for GUC recovery_target_xid
Date: 2026-02-26 07:20:18
Message-ID: 177209041824.626.6221932041384217360.pgcf@coridan.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi David,

The approach LGTM and checked the previous patch too. I have a few things to add.

The following grammar can be changed by adding "without epoch must be greater than or equal to %u"
+ GUC_check_errdetail("\"%s\" without epoch must greater than or equal to %u.",
+ "recovery_target_xid",
+ FirstNormalTransactionId);

Secondly,

The comment on the lower-bound XID test says # Timeline target out of min range — should be # XID target out of min range.

+# Timeline target out of min range
+$node_standby->append_conf('postgresql.conf',
+ "recovery_target_xid = '0'");
+

When it comes to *endp validations I suppose the validation passes when we provide recovery_target_xid = '-1'. This passes the endp validation and FirstNormalTransactionId checks. Is it a valid approach to allow negative values to this GUC ?

When -1 is provided the following checks allow them to be a valid GUC.

+ /*
+ * This cast will remove the epoch, if any
+ */
+ xid = (TransactionId) strtou64(*newval, &endp, 0);
+
+ if (*endp != '\0' || errno == EINVAL || errno == ERANGE)
+ {
+ GUC_check_errdetail("\"%s\" is not a valid number.",
+ "recovery_target_xid");
+ return false;
+ }

Regards.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wenhui qiu 2026-02-26 07:32:31 Re: [PROPOSAL] Doublewrite Buffer as an alternative torn page protection to Full Page Write
Previous Message 陈宗志 2026-02-26 07:13:58 Re: [PROPOSAL] Doublewrite Buffer as an alternative torn page protection to Full Page Write