If wait_for_catchup fails under has_wal_read_bug, skip balance of test.
authorNoah Misch <noah@leadboat.com>
Sat, 12 Nov 2022 19:19:50 +0000 (11:19 -0800)
committerNoah Misch <noah@leadboat.com>
Sat, 12 Nov 2022 19:19:50 +0000 (11:19 -0800)
Test files should now ignore has_wal_read_bug() so long as
wait_for_catchup() is their only known way of reaching the bug.  That's
at least five files today, a number expected to grow over time.  This
commit removes skip logic from three.  By doing so, systems having the
bug regain the ability to catch other kinds of defects via those three
tests.  The other two, 002_databases.pl and 031_recovery_conflict.pl,
have been unprotected.  Back-patch to v15, where done_testing() first
became our standard.

Discussion: https://postgr.es/m/20221030031639.GA3082137@rfd.leadboat.com

contrib/bloom/t/001_wal.pl
src/test/perl/PostgreSQL/Test/Cluster.pm
src/test/recovery/t/027_stream_regress.pl
src/test/recovery/t/032_relfilenode_reuse.pl

index f7f16dc5fa255623dc4317582b55f7fedfb479e1..9416a64dbd6841142b5ab65ebf3168028db6fc31 100644 (file)
@@ -8,13 +8,6 @@ use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
 
-if (PostgreSQL::Test::Utils::has_wal_read_bug)
-{
-       # We'd prefer to use Test::More->builder->todo_start, but the bug causes
-       # this test file to die(), not merely to fail.
-       plan skip_all => 'filesystem bug';
-}
-
 my $node_primary;
 my $node_standby;
 
index d80134b26f37b1421c9e974b8958ff7429bb171f..d1017b746fc81ab736dc95d189e11edb14cb92cc 100644 (file)
@@ -2606,8 +2606,23 @@ sub wait_for_catchup
        my $query = qq[SELECT '$target_lsn' <= ${mode}_lsn AND state = 'streaming'
          FROM pg_catalog.pg_stat_replication
          WHERE application_name IN ('$standby_name', 'walreceiver')];
-       $self->poll_query_until('postgres', $query)
-         or croak "timed out waiting for catchup";
+       if (!$self->poll_query_until('postgres', $query))
+       {
+               if (PostgreSQL::Test::Utils::has_wal_read_bug)
+               {
+                       # Mimic having skipped the test file.  If >0 tests have run, the
+                       # harness won't accept a skip; otherwise, it won't accept
+                       # done_testing().  Force a nonzero count by running one test.
+                       ok(1, 'dummy test before skip for filesystem bug');
+                       carp "skip rest: timed out waiting for catchup & filesystem bug";
+                       done_testing();
+                       exit 0;
+               }
+               else
+               {
+                       croak "timed out waiting for catchup";
+               }
+       }
        print "done\n";
        return;
 }
index 7982ac08d0aa6a8ca8089a07752de31ad37efb7c..69d6ddf2810333487cf42f69621cc3d1609c30e3 100644 (file)
@@ -6,13 +6,6 @@ use PostgreSQL::Test::Utils;
 use Test::More;
 use File::Basename;
 
-if (PostgreSQL::Test::Utils::has_wal_read_bug)
-{
-       # We'd prefer to use Test::More->builder->todo_start, but the bug causes
-       # this test file to die(), not merely to fail.
-       plan skip_all => 'filesystem bug';
-}
-
 # Initialize primary node
 my $node_primary = PostgreSQL::Test::Cluster->new('primary');
 $node_primary->init(allows_streaming => 1);
index 499ec34a7aa8095bff044953398389e511755090..92ec510037a19dec7b9362432d1d30dba16bc6ba 100644 (file)
@@ -5,13 +5,6 @@ use PostgreSQL::Test::Utils;
 use Test::More;
 use File::Basename;
 
-if (PostgreSQL::Test::Utils::has_wal_read_bug)
-{
-       # We'd prefer to use Test::More->builder->todo_start, but the bug causes
-       # this test file to die(), not merely to fail.
-       plan skip_all => 'filesystem bug';
-}
-
 
 my $node_primary = PostgreSQL::Test::Cluster->new('primary');
 $node_primary->init(allows_streaming => 1);