postgres.git / summary / log / commit / refs
commit 8e6860fb9638b5db784a24419d4441f0bf2cd04c
Author: Michael Paquier <michael@paquier.xyz>
Date: Wed Sep 02 00:19:32 2026 +0000
First released in: 17.12, 18.7, 19.0
Speed up pg_waldump TAP test
Several invocations decoded and printed the full WAL range even though
the test only needs to confirm that a command form works or that
decoding reaches a specific error. Limit those checks to one record,
and start the fall-off-the-end checks near the end of the generated WAL.
This change reduces the IPC overhead overall, particularly on Windows,
without reducing coverage.
I am usually hesitant to backpatch such changes as this is only an
improvement, but the gains are too good in terms of IO and runtime, for
both the CI and the buildfarm. Based on the numbers provided, the CI
takes 30% less time to run the test with this change on Windows (worst
case shown on the lists). These tests have been introduced in
96063e28366b.
Author: Sehrope Sarkuni <sehrope@jackdb.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAH7T-araSEdsNpxiKaMOW8kr_ZHhekCLHx5yzm2ksq4FdgULbA@mail.gmail.com
Backpatch-through: 17
src/bin/pg_waldump/t/001_basic.pl | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl
index 53b2f016b80..86554f9f03d 100644
--- a/src/bin/pg_waldump/t/001_basic.pl
+++ b/src/bin/pg_waldump/t/001_basic.pl
@@ -227,8 +227,14 @@ command_fails_like(
[ 'pg_waldump', 'foo', 'bar' ],
qr/error: could not locate WAL file "foo"/,
'start file not found');
-command_like([ 'pg_waldump', $node->data_dir . '/pg_wal/' . $start_walfile ],
- qr/./, 'runs with start segment specified');
+command_like(
+ [
+ 'pg_waldump',
+ '--limit' => 1,
+ $node->data_dir . '/pg_wal/' . $start_walfile
+ ],
+ qr/./,
+ 'runs with start segment specified');
command_fails_like(
[ 'pg_waldump', $node->data_dir . '/pg_wal/' . $start_walfile, 'bar' ],
qr/error: could not open file "bar"/,
@@ -236,6 +242,7 @@ command_fails_like(
command_like(
[
'pg_waldump',
+ '--limit' => 1,
$node->data_dir . '/pg_wal/' . $start_walfile,
$node->data_dir . '/pg_wal/' . $end_walfile
],
@@ -244,6 +251,7 @@ command_like(
command_like(
[
'pg_waldump', '--quiet',
+ '--limit' => 1,
'--path', $node->data_dir . '/pg_wal/',
$start_walfile
],
@@ -297,6 +305,7 @@ sub test_pg_waldump_skip_bytes
'--start' => $new_start,
'--end' => $endlsn,
'--path' => $path,
+ '--limit' => 1,
],
'>' => \$stdout,
'2>' => \$stderr;
@@ -409,14 +418,18 @@ for my $scenario (@scenarios)
'--path' => $path,
'--start' => $start_lsn,
'--end' => $end_lsn,
+ '--limit' => 1,
],
qr/./,
'runs with path option and start and end locations');
+
+ # Start near the end to avoid decoding records that are not relevant
+ # to the fall-off-the-end tests.
command_fails_like(
[
'pg_waldump',
'--path' => $path,
- '--start' => $start_lsn,
+ '--start' => $contrecord_lsn,
],
qr/error: error in WAL record at/,
'falling off the end of the WAL results in an error');
@@ -425,7 +438,7 @@ for my $scenario (@scenarios)
[
'pg_waldump', '--quiet',
'--path' => $path,
- '--start' => $start_lsn
+ '--start' => $contrecord_lsn
],
qr/error: error in WAL record at/,
'errors are shown with --quiet');
[parent: c586a5336a5b]