pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: pg_dump test instability
Date: Mon, 27 Aug 2018 08:34:17 +0200
Message-ID: <5137fe12-d0a2-4971-61b6-eb4e7e8875f8@2ndquadrant.com> (raw)

During the development of an unrelated feature, I have experienced
failures in a pg_dump test case, specifically

t/002_pg_dump.pl ....... 1825/6052
#   Failed test 'defaults_parallel: should not dump COPY
fk_reference_test_table second'
#   at t/002_pg_dump.pl line 3454.

This test sets up two tables connected by a foreign key and checks that
a data_only dump dumps them ordered so that the primary key table comes
first.

But because of the way the tests are set up, it also checks that in all
other dumps (i.e., non-data_only) it does *not* dump them in that order.
 This is kind of irrelevant to the test, but there is no way to express
in the pg_dump tests to not check certain scenarios.

In a non-data_only dump, the order of the tables doesn't matter, because
the foreign keys are added at the very end.  In parallel dumps, the
tables are in addition sorted by size, so the resultant order is
different from a single-threaded dump.  This can be seen by comparing
the dumped TOCs of the defaults_dir_format and defaults_parallel cases.
But it all happens to pass the tests right now.

In my hacking I have added another test table to the pg_dump test set,
which seems to have thrown off the sorting and scheduling, so that the
two tables now happen to come out in primary-key-first order anyway,
which causes the test to fail.

I have developed the attached rough patch to add a third option to
pg_dump test cases: besides like and unlike, add a "skip" option to
disregard the result of the test.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-Add-option-to-skip-certain-pg_dump-tests.patch (text/plain, 1.1K) download From 27196fc3a315d44891f2711bbfd90d72ebe4364f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Mon, 27 Aug 2018 08:22:10 +0200 Subject: [PATCH] Add option to skip certain pg_dump tests --- src/bin/pg_dump/t/002_pg_dump.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 1dd859f1c5..356a7a3f7a 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -1223,6 +1223,7 @@ \n(?:\d\n){5}\\\.\n /xms, like => { data_only => 1, }, + skip => { defaults => 1, }, }, 'COPY test_second_table' => { @@ -3254,6 +3255,7 @@ # Then count all the tests run against each run foreach my $test (sort keys %tests) { + next if $tests{$test}->{skip}->{$test_key}; # postgres is the default database, if it isn't overridden my $test_db = 'postgres'; @@ -3415,6 +3417,8 @@ foreach my $test (sort keys %tests) { + next if $tests{$test}->{skip}->{$test_key}; + my $test_db = 'postgres'; if (defined($pgdump_runs{$run}->{database})) -- 2.18.0

view thread (14+ messages)  latest in thread

Message-ID: <5137fe12-d0a2-4971-61b6-eb4e7e8875f8@2ndquadrant.com>
Permalink:  ../5137fe12-d0a2-4971-61b6-eb4e7e8875f8@2ndquadrant.com/
Also on:    postgresql.org/message-id/5137fe12-d0a2-4971-61b6-eb4e7e8875f8@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com
  Subject: Re: pg_dump test instability
  In-Reply-To: <5137fe12-d0a2-4971-61b6-eb4e7e8875f8@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox