On 3/5/26 19:42, Fujii Masao wrote:
On Thu, Mar 5, 2026 at 5:15 PM David Steele <[email protected]> wrote:
On 3/5/26 12:03, Fujii Masao wrote:
On Thu, Mar 5, 2026 at 1:21 PM David Steele <[email protected]> wrote:
The prior standby is not running because of the invalid config. I
figured it was better to start clean but when I update the
recovery_target_timeline tests I was planning to use the same standby
for all the new tests.
Alternatively, we can use $node_primary, since ALTER SYSTEM SET with
invalid recovery_target_timeline or recovery_target_xid does not
affect the primary.
Well, as it turns out I was using the primary after all because I copied
your example and forgot to update the host. Seems weird to set these
GUCs on the primary but as long as we get the expected errors I don't
suppose it matters.
Thanks for updating the patch! I've pushed the patch.
Excellent, thank you!
Attached are the test changes for recovery_target_timeline. I can start
a new thread and add it to the next CF if you like, but since it is just
test changes maybe we can fast track it.
Regards,
-David
From c70d06d415852e1d7b9bd44d17e9efaf491dfc1d Mon Sep 17 00:00:00 2001
From: David Steele <[email protected]>
Date: Thu, 5 Mar 2026 13:27:58 +0000
Subject: Improve tests for recovery_target_timeline GUC.
Update the recovery_target_timeline tests to match the simpler format
used for recovery_target_xid in bffd7130.
---
src/test/recovery/t/003_recovery_targets.pl | 68 ++++++---------------
1 file changed, 20 insertions(+), 48 deletions(-)
diff --git a/src/test/recovery/t/003_recovery_targets.pl
b/src/test/recovery/t/003_recovery_targets.pl
index 4e36e3a3fb5..047eb13293a 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -190,58 +190,30 @@ like(
qr/FATAL: .* recovery ended before configured recovery target was
reached/,
'recovery end before target reached is a fatal error');
-# Invalid timeline target
-$node_standby = PostgreSQL::Test::Cluster->new('standby_9');
-$node_standby->init_from_backup($node_primary, 'my_backup',
- has_restoring => 1);
-$node_standby->append_conf('postgresql.conf',
- "recovery_target_timeline = 'bogus'");
-
-$res = run_log(
- [
- 'pg_ctl',
- '--pgdata' => $node_standby->data_dir,
- '--log' => $node_standby->logfile,
- 'start',
- ]);
-ok(!$res, 'invalid timeline target (bogus value)');
-
-my $log_start = $node_standby->wait_for_log("is not a valid number");
-
-# Timeline target out of min range
-$node_standby->append_conf('postgresql.conf',
- "recovery_target_timeline = '0'");
-
-$res = run_log(
- [
- 'pg_ctl',
- '--pgdata' => $node_standby->data_dir,
- '--log' => $node_standby->logfile,
- 'start',
- ]);
-ok(!$res, 'invalid timeline target (lower bound check)');
-
-$log_start =
- $node_standby->wait_for_log("must be between 1 and 4294967295", $log_start);
-
-# Timeline target out of max range
-$node_standby->append_conf('postgresql.conf',
- "recovery_target_timeline = '4294967296'");
+# Invalid recovery_target_timeline tests
+my ($result, $stdout, $stderr) = $node_primary->psql('postgres',
+ "ALTER SYSTEM SET recovery_target_timeline TO 'bogus'");
+like(
+ $stderr,
+ qr/is not a valid number/,
+ "invalid recovery_target_timeline (bogus value)");
-$res = run_log(
- [
- 'pg_ctl',
- '--pgdata' => $node_standby->data_dir,
- '--log' => $node_standby->logfile,
- 'start',
- ]);
-ok(!$res, 'invalid timeline target (upper bound check)');
+($result, $stdout, $stderr) = $node_primary->psql('postgres',
+ "ALTER SYSTEM SET recovery_target_timeline TO '0'");
+like(
+ $stderr,
+ qr/must be between 1 and 4294967295/,
+ "invalid recovery_target_timeline (lower bound check)");
-$log_start =
- $node_standby->wait_for_log("must be between 1 and 4294967295", $log_start);
+($result, $stdout, $stderr) = $node_primary->psql('postgres',
+ "ALTER SYSTEM SET recovery_target_timeline TO '4294967296'");
+like(
+ $stderr,
+ qr/must be between 1 and 4294967295/,
+ "invalid recovery_target_timeline (upper bound check)");
# Invalid recovery_target_xid tests
-my ($result, $stdout, $stderr) = $node_primary->psql('postgres',
+($result, $stdout, $stderr) = $node_primary->psql('postgres',
"ALTER SYSTEM SET recovery_target_xid TO 'bogus'");
like(
$stderr,
--
2.34.1