diff options
author | Tom Lane | 2017-08-14 21:29:33 +0000 |
---|---|---|
committer | Tom Lane | 2017-08-14 21:29:33 +0000 |
commit | 21d304dfedb4f26d0d6587d9ac39b1b5c499bb55 (patch) | |
tree | bd5328464e037f15bf069fb91d54db06509b459c /src/test | |
parent | 5b6289c1e07dc45f09c3169a189e60d2fcaec2b3 (diff) |
Final pgindent + perltidy run for v10.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/perl/PostgresNode.pm | 5 | ||||
-rw-r--r-- | src/test/perl/TestLib.pm | 1 | ||||
-rw-r--r-- | src/test/recovery/t/001_stream_rep.pl | 54 | ||||
-rw-r--r-- | src/test/recovery/t/006_logical_decoding.pl | 6 | ||||
-rw-r--r-- | src/test/recovery/t/007_sync_rep.pl | 2 | ||||
-rw-r--r-- | src/test/recovery/t/009_twophase.pl | 23 | ||||
-rw-r--r-- | src/test/recovery/t/010_logical_decoding_timelines.pl | 3 | ||||
-rw-r--r-- | src/test/subscription/t/001_rep_changes.pl | 27 |
8 files changed, 63 insertions, 58 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index bf982101a57..d9aeb277d96 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1232,10 +1232,9 @@ sub poll_query_until { my ($self, $dbname, $query, $expected) = @_; - $expected = 't' unless defined($expected); # default value + $expected = 't' unless defined($expected); # default value - my $cmd = - [ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ]; + my $cmd = [ 'psql', '-XAt', '-c', $query, '-d', $self->connstr($dbname) ]; my ($stdout, $stderr); my $max_attempts = 180 * 10; my $attempts = 0; diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index bff6b3aed27..6dba21c0736 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -303,6 +303,7 @@ sub command_like sub command_like_safe { + # Doesn't rely on detecting end of file on the file descriptors, # which can fail, causing the process to hang, notably on Msys # when used with 'pg_ctl start' diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl index 23a19c67bf6..fb279250699 100644 --- a/src/test/recovery/t/001_stream_rep.pl +++ b/src/test/recovery/t/001_stream_rep.pl @@ -152,12 +152,12 @@ sub get_slot_xmins { my ($node, $slotname, $check_expr) = @_; - $node->poll_query_until('postgres', qq[ + $node->poll_query_until( + 'postgres', qq[ SELECT $check_expr FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slotname'; - ]) - or die "Timed out waiting for slot xmins to advance"; + ]) or die "Timed out waiting for slot xmins to advance"; my $slotinfo = $node->slot($slotname); return ($slotinfo->{'xmin'}, $slotinfo->{'catalog_xmin'}); @@ -166,14 +166,16 @@ sub get_slot_xmins # There's no hot standby feedback and there are no logical slots on either peer # so xmin and catalog_xmin should be null on both slots. my ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1, - "xmin IS NULL AND catalog_xmin IS NULL"); -is($xmin, '', 'xmin of non-cascaded slot null with no hs_feedback'); -is($catalog_xmin, '', 'catalog xmin of non-cascaded slot null with no hs_feedback'); + "xmin IS NULL AND catalog_xmin IS NULL"); +is($xmin, '', 'xmin of non-cascaded slot null with no hs_feedback'); +is($catalog_xmin, '', + 'catalog xmin of non-cascaded slot null with no hs_feedback'); ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin IS NULL AND catalog_xmin IS NULL"); -is($xmin, '', 'xmin of cascaded slot null with no hs_feedback'); -is($catalog_xmin, '', 'catalog xmin of cascaded slot null with no hs_feedback'); + "xmin IS NULL AND catalog_xmin IS NULL"); +is($xmin, '', 'xmin of cascaded slot null with no hs_feedback'); +is($catalog_xmin, '', + 'catalog xmin of cascaded slot null with no hs_feedback'); # Replication still works? $node_master->safe_psql('postgres', 'CREATE TABLE replayed(val integer);'); @@ -210,19 +212,20 @@ $node_standby_2->reload; replay_check(); ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1, - "xmin IS NOT NULL AND catalog_xmin IS NULL"); + "xmin IS NOT NULL AND catalog_xmin IS NULL"); isnt($xmin, '', 'xmin of non-cascaded slot non-null with hs feedback'); is($catalog_xmin, '', 'catalog xmin of non-cascaded slot still null with hs_feedback'); my ($xmin1, $catalog_xmin1) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin IS NOT NULL AND catalog_xmin IS NULL"); + "xmin IS NOT NULL AND catalog_xmin IS NULL"); isnt($xmin1, '', 'xmin of cascaded slot non-null with hs feedback'); is($catalog_xmin1, '', 'catalog xmin of cascaded slot still null with hs_feedback'); note "doing some work to advance xmin"; -$node_master->safe_psql('postgres', q{ +$node_master->safe_psql( + 'postgres', q{ do $$ begin for i in 10000..11000 loop @@ -239,15 +242,16 @@ end$$; $node_master->safe_psql('postgres', 'VACUUM;'); $node_master->safe_psql('postgres', 'CHECKPOINT;'); -my ($xmin2, $catalog_xmin2) = get_slot_xmins($node_master, $slotname_1, - "xmin <> '$xmin'"); +my ($xmin2, $catalog_xmin2) = + get_slot_xmins($node_master, $slotname_1, "xmin <> '$xmin'"); note "master slot's new xmin $xmin2, old xmin $xmin"; isnt($xmin2, $xmin, 'xmin of non-cascaded slot with hs feedback has changed'); is($catalog_xmin2, '', - 'catalog xmin of non-cascaded slot still null with hs_feedback unchanged'); + 'catalog xmin of non-cascaded slot still null with hs_feedback unchanged' +); -($xmin2, $catalog_xmin2) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin <> '$xmin1'"); +($xmin2, $catalog_xmin2) = + get_slot_xmins($node_standby_1, $slotname_2, "xmin <> '$xmin1'"); note "standby_1 slot's new xmin $xmin2, old xmin $xmin1"; isnt($xmin2, $xmin1, 'xmin of cascaded slot with hs feedback has changed'); is($catalog_xmin2, '', @@ -265,14 +269,14 @@ $node_standby_2->reload; replay_check(); ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1, - "xmin IS NULL AND catalog_xmin IS NULL"); + "xmin IS NULL AND catalog_xmin IS NULL"); is($xmin, '', 'xmin of non-cascaded slot null with hs feedback reset'); is($catalog_xmin, '', - 'catalog xmin of non-cascaded slot still null with hs_feedback reset'); + 'catalog xmin of non-cascaded slot still null with hs_feedback reset'); ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin IS NULL AND catalog_xmin IS NULL"); -is($xmin, '', 'xmin of cascaded slot null with hs feedback reset'); + "xmin IS NULL AND catalog_xmin IS NULL"); +is($xmin, '', 'xmin of cascaded slot null with hs feedback reset'); is($catalog_xmin, '', 'catalog xmin of cascaded slot still null with hs_feedback reset'); @@ -288,14 +292,14 @@ $node_standby_2->safe_psql('postgres', 'ALTER SYSTEM SET hot_standby_feedback = off;'); $node_standby_2->stop; -($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin IS NOT NULL"); +($xmin, $catalog_xmin) = + get_slot_xmins($node_standby_1, $slotname_2, "xmin IS NOT NULL"); isnt($xmin, '', 'xmin of cascaded slot non-null with postgres shut down'); # Xmin from a previous run should be cleared on startup. $node_standby_2->start; -($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2, - "xmin IS NULL"); +($xmin, $catalog_xmin) = + get_slot_xmins($node_standby_1, $slotname_2, "xmin IS NULL"); is($xmin, '', 'xmin of cascaded slot reset after startup with hs feedback reset'); diff --git a/src/test/recovery/t/006_logical_decoding.pl b/src/test/recovery/t/006_logical_decoding.pl index ea389ba4636..4a90e9ac7e2 100644 --- a/src/test/recovery/t/006_logical_decoding.pl +++ b/src/test/recovery/t/006_logical_decoding.pl @@ -111,8 +111,7 @@ SKIP: '-S', 'otherdb_slot', '-f', '-', '--start' ]); $node_master->poll_query_until('otherdb', "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)" - ) - or die "slot never became active"; + ) or die "slot never became active"; is($node_master->psql('postgres', 'DROP DATABASE otherdb'), 3, 'dropping a DB with active logical slots fails'); $pg_recvlogical->kill_kill; @@ -122,8 +121,7 @@ SKIP: $node_master->poll_query_until('otherdb', "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)" -) - or die "slot never became inactive"; +) or die "slot never became inactive"; is($node_master->psql('postgres', 'DROP DATABASE otherdb'), 0, 'dropping a DB with inactive logical slots succeeds'); diff --git a/src/test/recovery/t/007_sync_rep.pl b/src/test/recovery/t/007_sync_rep.pl index 0f999f05359..e21d1a52746 100644 --- a/src/test/recovery/t/007_sync_rep.pl +++ b/src/test/recovery/t/007_sync_rep.pl @@ -23,7 +23,7 @@ sub test_sync_state $self->reload; } - ok( $self->poll_query_until('postgres', $check_sql, $expected), $msg); + ok($self->poll_query_until('postgres', $check_sql, $expected), $msg); } # Initialize master node diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl index 1d1dae66f2b..6c501395722 100644 --- a/src/test/recovery/t/009_twophase.pl +++ b/src/test/recovery/t/009_twophase.pl @@ -18,8 +18,7 @@ sub configure_and_reload 'postgresql.conf', qq( $parameter )); - $node->psql('postgres', "SELECT pg_reload_conf()", - stdout => \$psql_out); + $node->psql('postgres', "SELECT pg_reload_conf()", stdout => \$psql_out); is($psql_out, 't', "reload node $name with $parameter"); } @@ -44,7 +43,7 @@ $node_paris->start; # Switch to synchronous replication in both directions configure_and_reload($node_london, "synchronous_standby_names = 'paris'"); -configure_and_reload($node_paris, "synchronous_standby_names = 'london'"); +configure_and_reload($node_paris, "synchronous_standby_names = 'london'"); # Set up nonce names for current master and standby nodes note "Initially, london is master and paris is standby"; @@ -352,7 +351,7 @@ $cur_master->psql( 'postgres', "SELECT * FROM t_009_tbl ORDER BY id", stdout => \$psql_out); -is($psql_out, qq{1|issued to london +is( $psql_out, qq{1|issued to london 2|issued to london 5|issued to london 6|issued to london @@ -374,14 +373,15 @@ is($psql_out, qq{1|issued to london 24|issued to paris 25|issued to london 26|issued to london}, - "Check expected t_009_tbl data on master"); + "Check expected t_009_tbl data on master"); $cur_master->psql( 'postgres', "SELECT * FROM t_009_tbl2", stdout => \$psql_out); -is($psql_out, qq{27|issued to paris}, - "Check expected t_009_tbl2 data on master"); +is( $psql_out, + qq{27|issued to paris}, + "Check expected t_009_tbl2 data on master"); $cur_standby->psql( 'postgres', @@ -393,7 +393,7 @@ $cur_standby->psql( 'postgres', "SELECT * FROM t_009_tbl ORDER BY id", stdout => \$psql_out); -is($psql_out, qq{1|issued to london +is( $psql_out, qq{1|issued to london 2|issued to london 5|issued to london 6|issued to london @@ -415,11 +415,12 @@ is($psql_out, qq{1|issued to london 24|issued to paris 25|issued to london 26|issued to london}, - "Check expected t_009_tbl data on standby"); + "Check expected t_009_tbl data on standby"); $cur_standby->psql( 'postgres', "SELECT * FROM t_009_tbl2", stdout => \$psql_out); -is($psql_out, qq{27|issued to paris}, - "Check expected t_009_tbl2 data on standby"); +is( $psql_out, + qq{27|issued to paris}, + "Check expected t_009_tbl2 data on standby"); diff --git a/src/test/recovery/t/010_logical_decoding_timelines.pl b/src/test/recovery/t/010_logical_decoding_timelines.pl index d4259808ddb..edc0219c9cd 100644 --- a/src/test/recovery/t/010_logical_decoding_timelines.pl +++ b/src/test/recovery/t/010_logical_decoding_timelines.pl @@ -117,8 +117,7 @@ $node_master->poll_query_until( SELECT catalog_xmin IS NOT NULL FROM pg_replication_slots WHERE slot_name = 'phys_slot' - ]) - or die "slot's catalog_xmin never became set"; + ]) or die "slot's catalog_xmin never became set"; my $phys_slot = $node_master->slot('phys_slot'); isnt($phys_slot->{'xmin'}, '', 'xmin assigned on physical slot of master'); diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl index 268808da7da..0136c79d4bc 100644 --- a/src/test/subscription/t/001_rep_changes.pl +++ b/src/test/subscription/t/001_rep_changes.pl @@ -22,16 +22,15 @@ $node_publisher->safe_psql('postgres', "CREATE TABLE tab_ins AS SELECT generate_series(1,1002) AS a"); $node_publisher->safe_psql('postgres', "CREATE TABLE tab_full AS SELECT generate_series(1,10) AS a"); -$node_publisher->safe_psql('postgres', - "CREATE TABLE tab_full2 (x text)"); +$node_publisher->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)"); $node_publisher->safe_psql('postgres', "INSERT INTO tab_full2 VALUES ('a'), ('b'), ('b')"); $node_publisher->safe_psql('postgres', "CREATE TABLE tab_rep (a int primary key)"); $node_publisher->safe_psql('postgres', - "CREATE TABLE tab_mixed (a int primary key, b text)"); + "CREATE TABLE tab_mixed (a int primary key, b text)"); $node_publisher->safe_psql('postgres', - "INSERT INTO tab_mixed (a, b) VALUES (1, 'foo')"); + "INSERT INTO tab_mixed (a, b) VALUES (1, 'foo')"); # Setup structure on subscriber $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)"); @@ -40,9 +39,10 @@ $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full (a int)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_rep (a int primary key)"); + # different column count and order than on publisher $node_subscriber->safe_psql('postgres', - "CREATE TABLE tab_mixed (c text, b text, a int primary key)"); + "CREATE TABLE tab_mixed (c text, b text, a int primary key)"); # Setup logical replication my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; @@ -50,7 +50,8 @@ $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub"); $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)"); $node_publisher->safe_psql('postgres', - "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed"); +"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed" +); $node_publisher->safe_psql('postgres', "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins"); @@ -89,7 +90,8 @@ $node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres', "DELETE FROM tab_rep WHERE a > 20"); $node_publisher->safe_psql('postgres', "UPDATE tab_rep SET a = -a"); -$node_publisher->safe_psql('postgres', "INSERT INTO tab_mixed VALUES (2, 'bar')"); +$node_publisher->safe_psql('postgres', + "INSERT INTO tab_mixed VALUES (2, 'bar')"); $node_publisher->poll_query_until('postgres', $caughtup_query) or die "Timed out while waiting for subscriber to catch up"; @@ -102,9 +104,9 @@ $result = $node_subscriber->safe_psql('postgres', "SELECT count(*), min(a), max(a) FROM tab_rep"); is($result, qq(20|-20|-1), 'check replicated changes on subscriber'); -$result = $node_subscriber->safe_psql('postgres', - "SELECT c, b, a FROM tab_mixed"); -is($result, qq(|foo|1 +$result = + $node_subscriber->safe_psql('postgres', "SELECT c, b, a FROM tab_mixed"); +is( $result, qq(|foo|1 |bar|2), 'check replicated changes with different column order'); # insert some duplicate rows @@ -127,7 +129,8 @@ $node_subscriber->safe_psql('postgres', # and do the updates $node_publisher->safe_psql('postgres', "UPDATE tab_full SET a = a * a"); -$node_publisher->safe_psql('postgres', "UPDATE tab_full2 SET x = 'bb' WHERE x = 'b'"); +$node_publisher->safe_psql('postgres', + "UPDATE tab_full2 SET x = 'bb' WHERE x = 'b'"); # Wait for subscription to catch up $node_publisher->poll_query_until('postgres', $caughtup_query) @@ -140,7 +143,7 @@ is($result, qq(20|1|100), $result = $node_subscriber->safe_psql('postgres', "SELECT x FROM tab_full2 ORDER BY 1"); -is($result, qq(a +is( $result, qq(a bb bb), 'update works with REPLICA IDENTITY FULL and text datums'); |