From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | David Steele <david(at)pgbackrest(dot)org> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Improve verification of recovery_target_timeline GUC. |
Date: | 2025-02-14 07:42:13 |
Message-ID: | Z67z1UndsbKGOuLt@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jan 24, 2025 at 01:36:45PM +0000, David Steele wrote:
> I attached the wrong patch. Oops!
Thanks for the new patch.
> + timeline = strtoull(*newval, &endp, 0);
> +
> + if (*endp != '\0' || errno == EINVAL || errno == ERANGE)
> {
> GUC_check_errdetail("\"recovery_target_timeline\" is not a valid number.");
> return false;
> }
Why not using strtou64() here? That's more portable depending on
SIZEOF_LONG (aka the 4 bytes on WIN32 vs 8 bytes for the rest of the
world).
> +
> + if (timeline < 2 || timeline > UINT_MAX)
> + {
A recovery_target_timeline of 1 is a valid value, isn't it?
> + GUC_check_errdetail(
> + "\"recovery_target_timeline\" must be between 2 and 4,294,967,295.");
> + return false;
> + }
I would suggest to rewrite that as \"%s\" must be between %u and %u,
which would be more generic for translations in case there is an
overlap with something else.
> +$logfile = slurp_file($node_standby->logfile());
> +ok($logfile =~ qr/must be between 2 and 4,294,967,295/,
> + 'target timelime out of max range');
These sequences of tests could be improved:
- Let's use start locations for the logs slurped, reducing the scope
of the logs scanned.
- Perhaps it would be better to rely on wait_for_log() to make sure
that the expected log contents are generated without any kind of race
condition?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2025-02-14 08:02:43 | Re: Update Unicode data to Unicode 16.0.0 |
Previous Message | Jakub Wartak | 2025-02-14 07:40:48 | Re: AIO v2.3 |