diff --git a/src/test/modules/test_checksums/t/013_rewind.pl b/src/test/modules/test_checksums/t/013_rewind.pl index 21715ace9f3..2cf411e9115 100644 --- a/src/test/modules/test_checksums/t/013_rewind.pl +++ b/src/test/modules/test_checksums/t/013_rewind.pl @@ -151,15 +151,27 @@ $backup_label =~ /^CHECKPOINT LOCATION: ([0-9A-F\/]+)$/m or die "checkpoint location missing from backup_label"; is($1, $shutdown_ckpt, 'replay starts at the switchover checkpoint'); -($stdout, $stderr) = run_command( +# Specify the WAL file so that pg_waldump does not try to determine the +# segment size from an arbitrary, possibly preallocated, file in pg_wal. +# This test would fail if the checkpoint record is straddling two WAL +# segments, if this is ever observed then support for reading the next +# segment as well. +$backup_label =~ + /^START WAL LOCATION: [0-9A-F\/]+ \(file ([0-9A-F]{8})[0-9A-F]{16}\)$/m + or die "WAL file name missing from backup_label"; +my $shutdown_wal = $1 + . $node_b->safe_psql('postgres', + "SELECT substr(pg_walfile_name('$shutdown_ckpt'), 9);"); + +command_like( [ 'pg_waldump', '-p' => $node_a->data_dir . '/pg_wal', - '-t' => 1, '-s' => $shutdown_ckpt, '-n' => 1, - ]); -like($stdout, qr/CHECKPOINT_SHUTDOWN/, + $shutdown_wal, + ], + qr/CHECKPOINT_SHUTDOWN/, 'last common checkpoint is a shutdown checkpoint'); # pg_rewind keeps the target's own checksum state in the control file it