]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Check status of nodes after regression test run in 027_stream_regress
authorMichael Paquier <michael@paquier.xyz>
Sat, 19 Jul 2025 06:03:14 +0000 (15:03 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 19 Jul 2025 06:03:14 +0000 (15:03 +0900)
This commit improves the recovery TAP test 027_stream_regress so as
regression diffs are printed only if both the primary and the standby
are still alive after the main regression test suite finishes, relying
on d4c9195eff41 to do the job.

Particularly, a crash of the primary could scribble the contents
reported with mostly useless data, as the diffs would refer to query
that failed to run, not necessarily the cause of the crash.

Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com

src/test/recovery/t/027_stream_regress.pl

index 83def062d11e10fa061d9f19e2d5a8dcf8102b2b..5d2c06ba06e734a248239d98ac979e54c2688068 100644 (file)
@@ -81,7 +81,14 @@ my $rc =
          . "--max-concurrent-tests=20 "
          . "--inputdir=../regress "
          . "--outputdir=\"$outputdir\"");
-if ($rc != 0)
+
+# Regression diffs are only meaningful if both the primary and the standby
+# are still alive after a regression test failure.  A crash would cause a
+# useless increase in the log quantity, mostly filled with information
+# related to queries that could not run.
+my $primary_alive = $node_primary->is_alive;
+my $standby_alive = $node_standby_1->is_alive;
+if ($rc != 0 && $primary_alive && $standby_alive)
 {
        # Dump out the regression diffs file, if there is one
        my $diffs = "$outputdir/regression.diffs";
@@ -93,6 +100,8 @@ if ($rc != 0)
        }
 }
 is($rc, 0, 'regression tests pass');
+is($primary_alive, 1, 'primary alive after regression test run');
+is($standby_alive, 1, 'standby alive after regression test run');
 
 # Clobber all sequences with their next value, so that we don't have
 # differences between nodes due to caching.