diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-05-12 13:14:10 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-05-12 13:14:10 -0400 |
commit | def5b065ff22a16a80084587613599fe15627213 (patch) | |
tree | 13f424449b7fb90c85659071b6adf4e27ae6d272 /src/bin/pg_rewind/t | |
parent | e6ccd1ce1644d1b40b7981f8bc172394de524f99 (diff) | |
download | postgresql-def5b065ff22a16a80084587613599fe15627213.tar.gz postgresql-def5b065ff22a16a80084587613599fe15627213.zip |
Initial pgindent and pgperltidy run for v14.
Also "make reformat-dat-files".
The only change worthy of note is that pgindent messed up the formatting
of launcher.c's struct LogicalRepWorkerId, which led me to notice that
that struct wasn't used at all anymore, so I just took it out.
Diffstat (limited to 'src/bin/pg_rewind/t')
-rw-r--r-- | src/bin/pg_rewind/t/001_basic.pl | 5 | ||||
-rw-r--r-- | src/bin/pg_rewind/t/003_extrafiles.pl | 9 | ||||
-rw-r--r-- | src/bin/pg_rewind/t/008_min_recovery_point.pl | 41 | ||||
-rw-r--r-- | src/bin/pg_rewind/t/RewindTest.pm | 6 |
4 files changed, 34 insertions, 27 deletions
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl index 15a6f25adee..d636f35f5e5 100644 --- a/src/bin/pg_rewind/t/001_basic.pl +++ b/src/bin/pg_rewind/t/001_basic.pl @@ -74,7 +74,8 @@ sub run_test primary_psql("VACUUM tail_tbl"); # Drop drop_tbl. pg_rewind should copy it back. - primary_psql("insert into drop_tbl values ('in primary, after promotion')"); + primary_psql( + "insert into drop_tbl values ('in primary, after promotion')"); primary_psql("DROP TABLE drop_tbl"); # Before running pg_rewind, do a couple of extra tests with several @@ -83,7 +84,7 @@ sub run_test # in "local" mode for simplicity's sake. if ($test_mode eq 'local') { - my $primary_pgdata = $node_primary->data_dir; + my $primary_pgdata = $node_primary->data_dir; my $standby_pgdata = $node_standby->data_dir; # First check that pg_rewind fails if the target cluster is diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl index 4fc500d4b4c..672c5e586ba 100644 --- a/src/bin/pg_rewind/t/003_extrafiles.pl +++ b/src/bin/pg_rewind/t/003_extrafiles.pl @@ -27,10 +27,13 @@ sub run_test # Create a subdir and files that will be present in both mkdir "$test_primary_datadir/tst_both_dir"; - append_to_file "$test_primary_datadir/tst_both_dir/both_file1", "in both1"; - append_to_file "$test_primary_datadir/tst_both_dir/both_file2", "in both2"; + append_to_file "$test_primary_datadir/tst_both_dir/both_file1", + "in both1"; + append_to_file "$test_primary_datadir/tst_both_dir/both_file2", + "in both2"; mkdir "$test_primary_datadir/tst_both_dir/both_subdir/"; - append_to_file "$test_primary_datadir/tst_both_dir/both_subdir/both_file3", + append_to_file + "$test_primary_datadir/tst_both_dir/both_subdir/both_file3", "in both3"; RewindTest::create_standby($test_mode); diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl index 7d9362cc229..9ebcbad0d26 100644 --- a/src/bin/pg_rewind/t/008_min_recovery_point.pl +++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl @@ -42,7 +42,8 @@ my $tmp_folder = TestLib::tempdir; my $node_1 = get_new_node('node_1'); $node_1->init(allows_streaming => 1); -$node_1->append_conf('postgresql.conf', qq( +$node_1->append_conf( + 'postgresql.conf', qq( wal_keep_size='100 MB' )); @@ -60,13 +61,11 @@ my $backup_name = 'my_backup'; $node_1->backup($backup_name); my $node_2 = get_new_node('node_2'); -$node_2->init_from_backup($node_1, $backup_name, - has_streaming => 1); +$node_2->init_from_backup($node_1, $backup_name, has_streaming => 1); $node_2->start; my $node_3 = get_new_node('node_3'); -$node_3->init_from_backup($node_1, $backup_name, - has_streaming => 1); +$node_3->init_from_backup($node_1, $backup_name, has_streaming => 1); $node_3->start; # Wait until node 3 has connected and caught up @@ -88,14 +87,16 @@ $node_3->safe_psql('postgres', "checkpoint"); # reconfigure node_1 as a standby following node_3 my $node_3_connstr = $node_3->connstr; -$node_1->append_conf('postgresql.conf', qq( +$node_1->append_conf( + 'postgresql.conf', qq( primary_conninfo='$node_3_connstr' )); $node_1->set_standby_mode(); $node_1->start(); # also reconfigure node_2 to follow node_3 -$node_2->append_conf('postgresql.conf', qq( +$node_2->append_conf( + 'postgresql.conf', qq( primary_conninfo='$node_3_connstr' )); $node_2->restart(); @@ -117,17 +118,21 @@ $node_1->safe_psql('postgres', "checkpoint"); # demonstratively create a split brain. After the rewind, we should only # see the insert on 1, as the insert on node 3 is rewound away. # -$node_1->safe_psql('postgres', "INSERT INTO public.foo (t) VALUES ('keep this')"); +$node_1->safe_psql('postgres', + "INSERT INTO public.foo (t) VALUES ('keep this')"); # 'bar' is unmodified in node 1, so it won't be overwritten by replaying the # WAL from node 1. -$node_3->safe_psql('postgres', "INSERT INTO public.bar (t) VALUES ('rewind this')"); +$node_3->safe_psql('postgres', + "INSERT INTO public.bar (t) VALUES ('rewind this')"); # Insert more rows in node 1, to bump up the XID counter. Otherwise, if # rewind doesn't correctly rewind the changes made on the other node, # we might fail to notice if the inserts are invisible because the XIDs # are not marked as committed. -$node_1->safe_psql('postgres', "INSERT INTO public.foo (t) VALUES ('and this')"); -$node_1->safe_psql('postgres', "INSERT INTO public.foo (t) VALUES ('and this too')"); +$node_1->safe_psql('postgres', + "INSERT INTO public.foo (t) VALUES ('and this')"); +$node_1->safe_psql('postgres', + "INSERT INTO public.foo (t) VALUES ('and this too')"); # Wait for node 2 to catch up $node_2->poll_query_until('postgres', @@ -138,7 +143,7 @@ $node_2->poll_query_until('postgres', $node_2->stop('fast'); $node_3->stop('fast'); -my $node_2_pgdata = $node_2->data_dir; +my $node_2_pgdata = $node_2->data_dir; my $node_1_connstr = $node_1->connstr; # Keep a temporary postgresql.conf or it would be overwritten during the rewind. @@ -147,12 +152,10 @@ copy( "$tmp_folder/node_2-postgresql.conf.tmp"); command_ok( - [ - 'pg_rewind', - "--source-server=$node_1_connstr", - "--target-pgdata=$node_2_pgdata", - "--debug" - ], + [ + 'pg_rewind', "--source-server=$node_1_connstr", + "--target-pgdata=$node_2_pgdata", "--debug" + ], 'run pg_rewind'); # Now move back postgresql.conf with old settings @@ -166,7 +169,7 @@ $node_2->start; # before rewind should've been overwritten with the data from node 1. my $result; $result = $node_2->safe_psql('postgres', 'SELECT * FROM public.foo'); -is($result, qq(keep this +is( $result, qq(keep this and this and this too), 'table foo after rewind'); diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm index 55a350af9d6..938c661afc2 100644 --- a/src/bin/pg_rewind/t/RewindTest.pm +++ b/src/bin/pg_rewind/t/RewindTest.pm @@ -223,7 +223,7 @@ sub promote_standby sub run_pg_rewind { my $test_mode = shift; - my $primary_pgdata = $node_primary->data_dir; + my $primary_pgdata = $node_primary->data_dir; my $standby_pgdata = $node_standby->data_dir; my $standby_connstr = $node_standby->connstr('postgres'); my $tmp_folder = TestLib::tempdir; @@ -286,8 +286,8 @@ sub run_pg_rewind # recovery configuration automatically. command_ok( [ - 'pg_rewind', "--debug", - "--source-server", $standby_connstr, + 'pg_rewind', "--debug", + "--source-server", $standby_connstr, "--target-pgdata=$primary_pgdata", "--no-sync", "--write-recovery-conf" ], |