Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f47ed79

Browse filesBrowse files
committed
Test replay of regression tests, attempt II.
See commit message for 123828a. The only change this time is the order of the arguments passed to pg_regress. The previously version broke in the build farm environment due to the contents of EXTRA_REGRESS_OPTS (see also commit 8cade04 which had to do something similar). Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com
1 parent 4c004dd commit f47ed79
Copy full SHA for f47ed79

File tree

Expand file treeCollapse file tree

4 files changed

+97
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+97
-1
lines changed

‎doc/src/sgml/regress.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/regress.sgml
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,17 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl'
289289
</para>
290290
</listitem>
291291
</varlistentry>
292+
293+
<varlistentry>
294+
<term><literal>wal_consistency_checking</literal></term>
295+
<listitem>
296+
<para>
297+
Uses <literal>wal_consistency_checking=all</literal> while running
298+
certain tests under <filename>src/test/recovery</filename>. Not
299+
enabled by default because it is resource intensive.
300+
</para>
301+
</listitem>
302+
</varlistentry>
292303
</variablelist>
293304

294305
Tests for features that are not supported by the current build

‎src/test/recovery/Makefile

Copy file name to clipboardExpand all lines: src/test/recovery/Makefile
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ subdir = src/test/recovery
1515
top_builddir = ../../..
1616
include $(top_builddir)/src/Makefile.global
1717

18-
# required for 017_shm.pl
18+
# required for 017_shm.pl and 027_stream_regress.pl
1919
REGRESS_SHLIB=$(abs_top_builddir)/src/test/regress/regress$(DLSUFFIX)
2020
export REGRESS_SHLIB
2121

22+
# required for 027_stream_regress.pl
23+
REGRESS_OUTPUTDIR=$(abs_top_builddir)/src/test/recovery
24+
export REGRESS_OUTPUTDIR
25+
2226
check:
2327
$(prove_check)
2428

+79Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Run the standard regression tests with streaming replication
2+
use strict;
3+
use warnings;
4+
use PostgreSQL::Test::Cluster;
5+
use PostgreSQL::Test::Utils;
6+
use Test::More tests => 4;
7+
use File::Basename;
8+
9+
# Initialize primary node
10+
my $node_primary = PostgreSQL::Test::Cluster->new('primary');
11+
$node_primary->init(allows_streaming => 1);
12+
$node_primary->adjust_conf('postgresql.conf', 'max_connections', '25', 1);
13+
$node_primary->append_conf('postgresql.conf', 'max_prepared_transactions = 10');
14+
15+
# WAL consistency checking is resource intensive so require opt-in with the
16+
# PG_TEST_EXTRA environment variable.
17+
if ($ENV{PG_TEST_EXTRA} &&
18+
$ENV{PG_TEST_EXTRA} =~ m/\bwal_consistency_checking\b/) {
19+
$node_primary->append_conf('postgresql.conf',
20+
'wal_consistency_checking = all');
21+
}
22+
23+
$node_primary->start;
24+
is( $node_primary->psql(
25+
'postgres',
26+
qq[SELECT pg_create_physical_replication_slot('standby_1');]),
27+
0,
28+
'physical slot created on primary');
29+
my $backup_name = 'my_backup';
30+
31+
# Take backup
32+
$node_primary->backup($backup_name);
33+
34+
# Create streaming standby linking to primary
35+
my $node_standby_1 = PostgreSQL::Test::Cluster->new('standby_1');
36+
$node_standby_1->init_from_backup($node_primary, $backup_name,
37+
has_streaming => 1);
38+
$node_standby_1->append_conf('postgresql.conf',
39+
"primary_slot_name = standby_1");
40+
$node_standby_1->start;
41+
42+
my $dlpath = PostgreSQL::Test::Utils::perl2host(dirname($ENV{REGRESS_SHLIB}));
43+
my $outputdir = PostgreSQL::Test::Utils::perl2host($ENV{REGRESS_OUTPUTDIR});
44+
45+
# Run the regression tests against the primary.
46+
my $extra_opts = $ENV{EXTRA_REGRESS_OPTS} || "";
47+
system_or_bail($ENV{PG_REGRESS} . " $extra_opts " .
48+
"--dlpath=\"$dlpath\" " .
49+
"--bindir= " .
50+
"--port=" . $node_primary->port . " " .
51+
"--schedule=../regress/parallel_schedule " .
52+
"--max-concurrent-tests=20 " .
53+
"--inputdir=../regress " .
54+
"--outputdir=\"$outputdir\"");
55+
56+
# Clobber all sequences with their next value, so that we don't have
57+
# differences between nodes due to caching.
58+
$node_primary->psql('regression',
59+
"select setval(seqrelid, nextval(seqrelid)) from pg_sequence");
60+
61+
# Wait for standby to catch up
62+
$node_primary->wait_for_catchup($node_standby_1, 'replay',
63+
$node_primary->lsn('insert'));
64+
65+
# Perform a logical dump of primary and standby, and check that they match
66+
command_ok(
67+
[ 'pg_dumpall', '-f', $outputdir . '/primary.dump', '--no-sync',
68+
'-p', $node_primary->port ],
69+
'dump primary server');
70+
command_ok(
71+
[ 'pg_dumpall', '-f', $outputdir . '/standby.dump', '--no-sync',
72+
'-p', $node_standby_1->port ],
73+
'dump standby server');
74+
command_ok(
75+
[ 'diff', $outputdir . '/primary.dump', $outputdir . '/standby.dump' ],
76+
'compare primary and standby dumps');
77+
78+
$node_standby_1->stop;
79+
$node_primary->stop;

‎src/tools/msvc/vcregress.pl

Copy file name to clipboardExpand all lines: src/tools/msvc/vcregress.pl
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ sub recoverycheck
536536
{
537537
InstallTemp();
538538

539+
$ENV{REGRESS_OUTPUTDIR} = "$topdir/src/test/recovery";
540+
539541
my $mstat = 0;
540542
my $dir = "$topdir/src/test/recovery";
541543
my $status = tap_check($dir);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.