Run perltidy
A follow-up patch will adjust the TAP tests to follow a more-structured format for option lists in commands, that perltidy is able to cope better with. Putting the tree first in a clean state makes the next change a bit easier. v20230309 has been used. Author: Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/87jzc46d8u.fsf@wibble.ilmari.org
This commit is contained in:
parent
4907ba304c
commit
be31ac2519
@ -364,7 +364,7 @@ my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
|
|||||||
# drives.
|
# drives.
|
||||||
rmdir("$pgdata/pg_replslot")
|
rmdir("$pgdata/pg_replslot")
|
||||||
or BAIL_OUT "could not remove $pgdata/pg_replslot";
|
or BAIL_OUT "could not remove $pgdata/pg_replslot";
|
||||||
mkdir("$sys_tempdir/pg_replslot"); # if this fails the symlink will fail
|
mkdir("$sys_tempdir/pg_replslot"); # if this fails the symlink will fail
|
||||||
dir_symlink("$sys_tempdir/pg_replslot", "$pgdata/pg_replslot")
|
dir_symlink("$sys_tempdir/pg_replslot", "$pgdata/pg_replslot")
|
||||||
or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
|
or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ EOM
|
|||||||
$node2->start();
|
$node2->start();
|
||||||
|
|
||||||
# Wait until recovery pauses, then promote.
|
# Wait until recovery pauses, then promote.
|
||||||
$node2->poll_query_until('postgres', "SELECT pg_get_wal_replay_pause_state() = 'paused';");
|
$node2->poll_query_until('postgres',
|
||||||
|
"SELECT pg_get_wal_replay_pause_state() = 'paused';");
|
||||||
$node2->safe_psql('postgres', "SELECT pg_promote()");
|
$node2->safe_psql('postgres', "SELECT pg_promote()");
|
||||||
|
|
||||||
# Once promotion occurs, insert a second row on the new node.
|
# Once promotion occurs, insert a second row on the new node.
|
||||||
@ -68,14 +69,16 @@ EOM
|
|||||||
# timeline change correctly, something should break at this point.
|
# timeline change correctly, something should break at this point.
|
||||||
my $backup2path = $node1->backup_dir . '/backup2';
|
my $backup2path = $node1->backup_dir . '/backup2';
|
||||||
$node2->command_ok(
|
$node2->command_ok(
|
||||||
[ 'pg_basebackup', '-D', $backup2path, '--no-sync', '-cfast',
|
[
|
||||||
'--incremental', $backup1path . '/backup_manifest' ],
|
'pg_basebackup', '-D', $backup2path, '--no-sync', '-cfast',
|
||||||
|
'--incremental', $backup1path . '/backup_manifest'
|
||||||
|
],
|
||||||
"incremental backup from node2");
|
"incremental backup from node2");
|
||||||
|
|
||||||
# Restore the incremental backup and use it to create a new node.
|
# Restore the incremental backup and use it to create a new node.
|
||||||
my $node3 = PostgreSQL::Test::Cluster->new('node3');
|
my $node3 = PostgreSQL::Test::Cluster->new('node3');
|
||||||
$node3->init_from_backup($node1, 'backup2',
|
$node3->init_from_backup($node1, 'backup2',
|
||||||
combine_with_prior => [ 'backup1' ]);
|
combine_with_prior => ['backup1']);
|
||||||
$node3->start();
|
$node3->start();
|
||||||
|
|
||||||
done_testing();
|
done_testing();
|
||||||
|
@ -46,9 +46,9 @@ for my $iname (@filelist)
|
|||||||
if (-f "$backup1path/base/1/$name")
|
if (-f "$backup1path/base/1/$name")
|
||||||
{
|
{
|
||||||
copy("$backup2path/base/1/$iname", "$backup1path/base/1/$iname")
|
copy("$backup2path/base/1/$iname", "$backup1path/base/1/$iname")
|
||||||
|| die "copy $backup2path/base/1/$iname: $!";
|
|| die "copy $backup2path/base/1/$iname: $!";
|
||||||
unlink("$backup1path/base/1/$name")
|
unlink("$backup1path/base/1/$name")
|
||||||
|| die "unlink $backup1path/base/1/$name: $!";
|
|| die "unlink $backup1path/base/1/$name: $!";
|
||||||
$success = 1;
|
$success = 1;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
@ -57,9 +57,7 @@ for my $iname (@filelist)
|
|||||||
# pg_combinebackup should fail.
|
# pg_combinebackup should fail.
|
||||||
my $outpath = $primary->backup_dir . '/out';
|
my $outpath = $primary->backup_dir . '/out';
|
||||||
$primary->command_fails_like(
|
$primary->command_fails_like(
|
||||||
[
|
[ 'pg_combinebackup', $backup1path, $backup2path, '-o', $outpath, ],
|
||||||
'pg_combinebackup', $backup1path, $backup2path, '-o', $outpath,
|
|
||||||
],
|
|
||||||
qr/full backup contains unexpected incremental file/,
|
qr/full backup contains unexpected incremental file/,
|
||||||
"pg_combinebackup fails");
|
"pg_combinebackup fails");
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@ sub test_checksums
|
|||||||
}
|
}
|
||||||
|
|
||||||
# A backup with a valid algorithm should work.
|
# A backup with a valid algorithm should work.
|
||||||
$primary->command_ok(\@backup, "$format format backup ok with algorithm \"$algorithm\"");
|
$primary->command_ok(\@backup,
|
||||||
|
"$format format backup ok with algorithm \"$algorithm\"");
|
||||||
|
|
||||||
# We expect each real checksum algorithm to be mentioned on every line of
|
# We expect each real checksum algorithm to be mentioned on every line of
|
||||||
# the backup manifest file except the first and last; for simplicity, we
|
# the backup manifest file except the first and last; for simplicity, we
|
||||||
@ -50,7 +51,8 @@ sub test_checksums
|
|||||||
# is none, we just check that the manifest exists.
|
# is none, we just check that the manifest exists.
|
||||||
if ($algorithm eq 'none')
|
if ($algorithm eq 'none')
|
||||||
{
|
{
|
||||||
ok(-f "$backup_path/backup_manifest", "$format format backup manifest exists");
|
ok( -f "$backup_path/backup_manifest",
|
||||||
|
"$format format backup manifest exists");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -60,12 +60,14 @@ my @scenario = (
|
|||||||
{
|
{
|
||||||
'name' => 'append_to_file',
|
'name' => 'append_to_file',
|
||||||
'mutilate' => \&mutilate_append_to_file,
|
'mutilate' => \&mutilate_append_to_file,
|
||||||
'fails_like' => qr/has size \d+ (on disk|in "[^"]+") but size \d+ in the manifest/
|
'fails_like' =>
|
||||||
|
qr/has size \d+ (on disk|in "[^"]+") but size \d+ in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'truncate_file',
|
'name' => 'truncate_file',
|
||||||
'mutilate' => \&mutilate_truncate_file,
|
'mutilate' => \&mutilate_truncate_file,
|
||||||
'fails_like' => qr/has size 0 (on disk|in "[^"]+") but size \d+ in the manifest/
|
'fails_like' =>
|
||||||
|
qr/has size 0 (on disk|in "[^"]+") but size \d+ in the manifest/
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name' => 'replace_file',
|
'name' => 'replace_file',
|
||||||
@ -147,8 +149,9 @@ for my $scenario (@scenario)
|
|||||||
# same problem, unless the scenario needs UNIX permissions or we don't
|
# same problem, unless the scenario needs UNIX permissions or we don't
|
||||||
# have a TAR program available. Note that this destructively modifies
|
# have a TAR program available. Note that this destructively modifies
|
||||||
# the backup directory.
|
# the backup directory.
|
||||||
if (! $scenario->{'needs_unix_permissions'} ||
|
if ( !$scenario->{'needs_unix_permissions'}
|
||||||
!defined $tar || $tar eq '')
|
|| !defined $tar
|
||||||
|
|| $tar eq '')
|
||||||
{
|
{
|
||||||
my $tar_backup_path = $primary->backup_dir . '/tar_' . $name;
|
my $tar_backup_path = $primary->backup_dir . '/tar_' . $name;
|
||||||
mkdir($tar_backup_path) || die "mkdir $tar_backup_path: $!";
|
mkdir($tar_backup_path) || die "mkdir $tar_backup_path: $!";
|
||||||
@ -156,14 +159,15 @@ for my $scenario (@scenario)
|
|||||||
# tar and then remove each tablespace. We remove the original files
|
# tar and then remove each tablespace. We remove the original files
|
||||||
# so that they don't also end up in base.tar.
|
# so that they don't also end up in base.tar.
|
||||||
my @tsoid = grep { $_ ne '.' && $_ ne '..' }
|
my @tsoid = grep { $_ ne '.' && $_ ne '..' }
|
||||||
slurp_dir("$backup_path/pg_tblspc");
|
slurp_dir("$backup_path/pg_tblspc");
|
||||||
my $cwd = getcwd;
|
my $cwd = getcwd;
|
||||||
for my $tsoid (@tsoid)
|
for my $tsoid (@tsoid)
|
||||||
{
|
{
|
||||||
my $tspath = $backup_path . '/pg_tblspc/' . $tsoid;
|
my $tspath = $backup_path . '/pg_tblspc/' . $tsoid;
|
||||||
|
|
||||||
chdir($tspath) || die "chdir: $!";
|
chdir($tspath) || die "chdir: $!";
|
||||||
command_ok([ $tar, '-cf', "$tar_backup_path/$tsoid.tar", '.' ]);
|
command_ok(
|
||||||
|
[ $tar, '-cf', "$tar_backup_path/$tsoid.tar", '.' ]);
|
||||||
chdir($cwd) || die "chdir: $!";
|
chdir($cwd) || die "chdir: $!";
|
||||||
rmtree($tspath);
|
rmtree($tspath);
|
||||||
}
|
}
|
||||||
@ -175,9 +179,10 @@ for my $scenario (@scenario)
|
|||||||
rmtree($backup_path . '/pg_wal');
|
rmtree($backup_path . '/pg_wal');
|
||||||
|
|
||||||
# move the backup manifest
|
# move the backup manifest
|
||||||
move($backup_path . '/backup_manifest',
|
move(
|
||||||
$tar_backup_path . '/backup_manifest')
|
$backup_path . '/backup_manifest',
|
||||||
or die "could not copy manifest to $tar_backup_path";
|
$tar_backup_path . '/backup_manifest'
|
||||||
|
) or die "could not copy manifest to $tar_backup_path";
|
||||||
|
|
||||||
# Construct base.tar with what's left.
|
# Construct base.tar with what's left.
|
||||||
chdir($backup_path) || die "chdir: $!";
|
chdir($backup_path) || die "chdir: $!";
|
||||||
|
@ -29,8 +29,7 @@ is($stdout, '', "-q succeeds: no stdout");
|
|||||||
is($stderr, '', "-q succeeds: no stderr");
|
is($stderr, '', "-q succeeds: no stderr");
|
||||||
|
|
||||||
# Should still work if we specify -Fp.
|
# Should still work if we specify -Fp.
|
||||||
$primary->command_ok(
|
$primary->command_ok([ 'pg_verifybackup', '-Fp', $backup_path ],
|
||||||
[ 'pg_verifybackup', '-Fp', $backup_path ],
|
|
||||||
"verifies with -Fp");
|
"verifies with -Fp");
|
||||||
|
|
||||||
# Should not work if we specify -Fy because that's invalid.
|
# Should not work if we specify -Fy because that's invalid.
|
||||||
|
@ -20,12 +20,14 @@ $primary->start;
|
|||||||
my $source_ts_path = PostgreSQL::Test::Utils::tempdir_short();
|
my $source_ts_path = PostgreSQL::Test::Utils::tempdir_short();
|
||||||
|
|
||||||
# Create a tablespace with table in it.
|
# Create a tablespace with table in it.
|
||||||
$primary->safe_psql('postgres', qq(
|
$primary->safe_psql(
|
||||||
|
'postgres', qq(
|
||||||
CREATE TABLESPACE regress_ts1 LOCATION '$source_ts_path';
|
CREATE TABLESPACE regress_ts1 LOCATION '$source_ts_path';
|
||||||
SELECT oid FROM pg_tablespace WHERE spcname = 'regress_ts1';
|
SELECT oid FROM pg_tablespace WHERE spcname = 'regress_ts1';
|
||||||
CREATE TABLE regress_tbl1(i int) TABLESPACE regress_ts1;
|
CREATE TABLE regress_tbl1(i int) TABLESPACE regress_ts1;
|
||||||
INSERT INTO regress_tbl1 VALUES(generate_series(1,5));));
|
INSERT INTO regress_tbl1 VALUES(generate_series(1,5));));
|
||||||
my $tsoid = $primary->safe_psql('postgres', qq(
|
my $tsoid = $primary->safe_psql(
|
||||||
|
'postgres', qq(
|
||||||
SELECT oid FROM pg_tablespace WHERE spcname = 'regress_ts1'));
|
SELECT oid FROM pg_tablespace WHERE spcname = 'regress_ts1'));
|
||||||
|
|
||||||
my $backup_path = $primary->backup_dir . '/server-backup';
|
my $backup_path = $primary->backup_dir . '/server-backup';
|
||||||
@ -35,7 +37,7 @@ my @test_configuration = (
|
|||||||
{
|
{
|
||||||
'compression_method' => 'none',
|
'compression_method' => 'none',
|
||||||
'backup_flags' => [],
|
'backup_flags' => [],
|
||||||
'backup_archive' => ['base.tar', "$tsoid.tar"],
|
'backup_archive' => [ 'base.tar', "$tsoid.tar" ],
|
||||||
'enabled' => 1
|
'enabled' => 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -47,7 +49,7 @@ my @test_configuration = (
|
|||||||
{
|
{
|
||||||
'compression_method' => 'lz4',
|
'compression_method' => 'lz4',
|
||||||
'backup_flags' => [ '--compress', 'server-lz4' ],
|
'backup_flags' => [ '--compress', 'server-lz4' ],
|
||||||
'backup_archive' => ['base.tar.lz4', "$tsoid.tar.lz4" ],
|
'backup_archive' => [ 'base.tar.lz4', "$tsoid.tar.lz4" ],
|
||||||
'enabled' => check_pg_config("#define USE_LZ4 1")
|
'enabled' => check_pg_config("#define USE_LZ4 1")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -95,7 +97,7 @@ for my $tc (@test_configuration)
|
|||||||
"found expected backup files, compression $method");
|
"found expected backup files, compression $method");
|
||||||
|
|
||||||
# Verify tar backup.
|
# Verify tar backup.
|
||||||
$primary->command_ok(['pg_verifybackup', '-n', '-e', $backup_path],
|
$primary->command_ok([ 'pg_verifybackup', '-n', '-e', $backup_path ],
|
||||||
"verify backup, compression $method");
|
"verify backup, compression $method");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
|
@ -108,7 +108,7 @@ for my $tc (@test_configuration)
|
|||||||
"found expected backup files, compression $method");
|
"found expected backup files, compression $method");
|
||||||
|
|
||||||
# Verify tar backup.
|
# Verify tar backup.
|
||||||
$primary->command_ok( [ 'pg_verifybackup', '-n', '-e', $backup_path ],
|
$primary->command_ok([ 'pg_verifybackup', '-n', '-e', $backup_path ],
|
||||||
"verify backup, compression $method");
|
"verify backup, compression $method");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
|
@ -1214,7 +1214,8 @@ sub stop
|
|||||||
|
|
||||||
print "### Stopping node \"$name\" using mode $mode\n";
|
print "### Stopping node \"$name\" using mode $mode\n";
|
||||||
my @cmd = ('pg_ctl', '-D', $pgdata, '-m', $mode, 'stop');
|
my @cmd = ('pg_ctl', '-D', $pgdata, '-m', $mode, 'stop');
|
||||||
if ($params{timeout}) {
|
if ($params{timeout})
|
||||||
|
{
|
||||||
push(@cmd, ('--timeout', $params{timeout}));
|
push(@cmd, ('--timeout', $params{timeout}));
|
||||||
}
|
}
|
||||||
$ret = PostgreSQL::Test::Utils::system_log(@cmd);
|
$ret = PostgreSQL::Test::Utils::system_log(@cmd);
|
||||||
|
@ -529,12 +529,14 @@ check_slots_conflict_reason('vacuum_full_', 'rows_removed');
|
|||||||
|
|
||||||
# Attempting to alter an invalidated slot should result in an error
|
# Attempting to alter an invalidated slot should result in an error
|
||||||
($result, $stdout, $stderr) = $node_standby->psql(
|
($result, $stdout, $stderr) = $node_standby->psql(
|
||||||
'postgres',
|
'postgres',
|
||||||
qq[ALTER_REPLICATION_SLOT vacuum_full_inactiveslot (failover);],
|
qq[ALTER_REPLICATION_SLOT vacuum_full_inactiveslot (failover);],
|
||||||
replication => 'database');
|
replication => 'database');
|
||||||
ok($stderr =~ /ERROR: cannot alter invalid replication slot "vacuum_full_inactiveslot"/ &&
|
ok( $stderr =~
|
||||||
$stderr =~ /DETAIL: This replication slot has been invalidated due to "rows_removed"./,
|
/ERROR: cannot alter invalid replication slot "vacuum_full_inactiveslot"/
|
||||||
"invalidated slot cannot be altered");
|
&& $stderr =~
|
||||||
|
/DETAIL: This replication slot has been invalidated due to "rows_removed"./,
|
||||||
|
"invalidated slot cannot be altered");
|
||||||
|
|
||||||
# Ensure that replication slot stats are not removed after invalidation.
|
# Ensure that replication slot stats are not removed after invalidation.
|
||||||
is( $node_standby->safe_psql(
|
is( $node_standby->safe_psql(
|
||||||
|
@ -95,7 +95,8 @@ $subscriber1->safe_psql('postgres',
|
|||||||
# Disable failover for enabled subscription
|
# Disable failover for enabled subscription
|
||||||
my ($result, $stdout, $stderr) = $subscriber1->psql('postgres',
|
my ($result, $stdout, $stderr) = $subscriber1->psql('postgres',
|
||||||
"ALTER SUBSCRIPTION regress_mysub1 SET (failover = false)");
|
"ALTER SUBSCRIPTION regress_mysub1 SET (failover = false)");
|
||||||
ok( $stderr =~ /ERROR: cannot set option "failover" for enabled subscription/,
|
ok( $stderr =~
|
||||||
|
/ERROR: cannot set option "failover" for enabled subscription/,
|
||||||
"altering failover is not allowed for enabled subscription");
|
"altering failover is not allowed for enabled subscription");
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
@ -280,7 +281,8 @@ $standby1->safe_psql('postgres', "SELECT pg_sync_replication_slots();");
|
|||||||
|
|
||||||
# Confirm that the invalidated slot has been dropped.
|
# Confirm that the invalidated slot has been dropped.
|
||||||
$standby1->wait_for_log(
|
$standby1->wait_for_log(
|
||||||
qr/dropped replication slot "lsub1_slot" of database with OID [0-9]+/, $log_offset);
|
qr/dropped replication slot "lsub1_slot" of database with OID [0-9]+/,
|
||||||
|
$log_offset);
|
||||||
|
|
||||||
# Confirm that the logical slot has been re-created on the standby and is
|
# Confirm that the logical slot has been re-created on the standby and is
|
||||||
# flagged as 'synced'
|
# flagged as 'synced'
|
||||||
|
@ -302,7 +302,8 @@ sub switch_server_cert
|
|||||||
$node->append_conf('sslconfig.conf', $backend->set_server_cert(\%params));
|
$node->append_conf('sslconfig.conf', $backend->set_server_cert(\%params));
|
||||||
# use lists of ECDH curves and cipher suites for syntax testing
|
# use lists of ECDH curves and cipher suites for syntax testing
|
||||||
$node->append_conf('sslconfig.conf', 'ssl_groups=prime256v1:secp521r1');
|
$node->append_conf('sslconfig.conf', 'ssl_groups=prime256v1:secp521r1');
|
||||||
$node->append_conf('sslconfig.conf', 'ssl_tls13_ciphers=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256');
|
$node->append_conf('sslconfig.conf',
|
||||||
|
'ssl_tls13_ciphers=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256');
|
||||||
|
|
||||||
$node->append_conf('sslconfig.conf',
|
$node->append_conf('sslconfig.conf',
|
||||||
"ssl_passphrase_command='" . $params{passphrase_cmd} . "'")
|
"ssl_passphrase_command='" . $params{passphrase_cmd} . "'")
|
||||||
|
@ -62,8 +62,9 @@ sub process_file
|
|||||||
|
|
||||||
# skip over commit links because we will add them below
|
# skip over commit links because we will add them below
|
||||||
next
|
next
|
||||||
if (!$in_comment &&
|
if (!$in_comment
|
||||||
m{^\s*<ulink url="&commit_baseurl;[[:xdigit:]]+">§</ulink>\s*$});
|
&& m{^\s*<ulink url="&commit_baseurl;[[:xdigit:]]+">§</ulink>\s*$}
|
||||||
|
);
|
||||||
|
|
||||||
if ($in_comment && m/\[([[:xdigit:]]+)\]/)
|
if ($in_comment && m/\[([[:xdigit:]]+)\]/)
|
||||||
{
|
{
|
||||||
@ -73,10 +74,10 @@ sub process_file
|
|||||||
(!m/^Branch:/) && push(@hashes, $hash);
|
(!m/^Branch:/) && push(@hashes, $hash);
|
||||||
|
|
||||||
# minor release item
|
# minor release item
|
||||||
m/^Branch:/ &&
|
m/^Branch:/
|
||||||
defined($major_version) &&
|
&& defined($major_version)
|
||||||
m/_${major_version}_/ &&
|
&& m/_${major_version}_/
|
||||||
push(@hashes, $hash);
|
&& push(@hashes, $hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$in_comment && m{</para>})
|
if (!$in_comment && m{</para>})
|
||||||
|
@ -49,7 +49,8 @@ while (my $test_src = glob("$src_dir/tests/*.0"))
|
|||||||
],
|
],
|
||||||
"pg_bsd_indent succeeds on $test");
|
"pg_bsd_indent succeeds on $test");
|
||||||
# check result matches, adding any diff to $diffs_file
|
# check result matches, adding any diff to $diffs_file
|
||||||
my $result = run_log([ 'diff', @diffopts, "$test_src.stdout", "$test.out" ],
|
my $result =
|
||||||
|
run_log([ 'diff', @diffopts, "$test_src.stdout", "$test.out" ],
|
||||||
'>>', $diffs_file);
|
'>>', $diffs_file);
|
||||||
ok($result, "pg_bsd_indent output matches for $test");
|
ok($result, "pg_bsd_indent output matches for $test");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user