diff options
author | Noah Misch <noah@leadboat.com> | 2016-06-12 04:19:56 -0400 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2016-06-12 04:19:56 -0400 |
commit | 3be0a62ffe58f0753d190cbe22acbeb8b4926b85 (patch) | |
tree | 6da431545c91d5f54d56b38208e8f946dcdbd6b4 /src/test/modules/commit_ts | |
parent | b098abf90537edf0ce9c70e8eb55320baf6e445d (diff) | |
download | postgresql-3be0a62ffe58f0753d190cbe22acbeb8b4926b85.tar.gz postgresql-3be0a62ffe58f0753d190cbe22acbeb8b4926b85.zip |
Finish pgindent run for 9.6: Perl files.
Diffstat (limited to 'src/test/modules/commit_ts')
-rw-r--r-- | src/test/modules/commit_ts/t/001_base.pl | 12 | ||||
-rw-r--r-- | src/test/modules/commit_ts/t/002_standby.pl | 34 | ||||
-rw-r--r-- | src/test/modules/commit_ts/t/003_standby_2.pl | 28 |
3 files changed, 47 insertions, 27 deletions
diff --git a/src/test/modules/commit_ts/t/001_base.pl b/src/test/modules/commit_ts/t/001_base.pl index f076a2739d4..427092cfc50 100644 --- a/src/test/modules/commit_ts/t/001_base.pl +++ b/src/test/modules/commit_ts/t/001_base.pl @@ -13,17 +13,21 @@ $node->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $node->start; # Create a table, compare "now()" to the commit TS of its xmin -$node->safe_psql('postgres', 'create table t as select now from (select now(), pg_sleep(1)) f'); +$node->safe_psql('postgres', + 'create table t as select now from (select now(), pg_sleep(1)) f'); my $true = $node->safe_psql('postgres', - 'select t.now - ts.* < \'1s\' from t, pg_class c, pg_xact_commit_timestamp(c.xmin) ts where relname = \'t\''); +'select t.now - ts.* < \'1s\' from t, pg_class c, pg_xact_commit_timestamp(c.xmin) ts where relname = \'t\'' +); is($true, 't', 'commit TS is set'); my $ts = $node->safe_psql('postgres', - 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''); +'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\'' +); # Verify that we read the same TS after crash recovery $node->stop('immediate'); $node->start; my $recovered_ts = $node->safe_psql('postgres', - 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\''); +'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t\'' +); is($recovered_ts, $ts, 'commit TS remains after crash recovery'); diff --git a/src/test/modules/commit_ts/t/002_standby.pl b/src/test/modules/commit_ts/t/002_standby.pl index 9410c9c3d25..4dbde2978e4 100644 --- a/src/test/modules/commit_ts/t/002_standby.pl +++ b/src/test/modules/commit_ts/t/002_standby.pl @@ -8,10 +8,11 @@ use Test::More tests => 4; use PostgresNode; my $bkplabel = 'backup'; -my $master = get_new_node('master'); +my $master = get_new_node('master'); $master->init(allows_streaming => 1); -$master->append_conf('postgresql.conf', qq{ +$master->append_conf( + 'postgresql.conf', qq{ track_commit_timestamp = on max_wal_senders = 5 wal_level = hot_standby @@ -28,30 +29,37 @@ for my $i (1 .. 10) $master->safe_psql('postgres', "create table t$i()"); } my $master_ts = $master->safe_psql('postgres', - qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}); -my $master_lsn = $master->safe_psql('postgres', - 'select pg_current_xlog_location()'); +qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'} +); +my $master_lsn = + $master->safe_psql('postgres', 'select pg_current_xlog_location()'); $standby->poll_query_until('postgres', qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()}) - or die "slave never caught up"; + or die "slave never caught up"; my $standby_ts = $standby->safe_psql('postgres', - qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'}); +qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'} +); is($master_ts, $standby_ts, "standby gives same value as master"); $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; $master->safe_psql('postgres', 'checkpoint'); -$master_lsn = $master->safe_psql('postgres', - 'select pg_current_xlog_location()'); +$master_lsn = + $master->safe_psql('postgres', 'select pg_current_xlog_location()'); $standby->poll_query_until('postgres', qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()}) - or die "slave never caught up"; + or die "slave never caught up"; $standby->safe_psql('postgres', 'checkpoint'); # This one should raise an error now my ($ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres', - 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\''); +'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\'' +); is($ret, 3, 'standby errors when master turned feature off'); -is($standby_ts_stdout, '', "standby gives no value when master turned feature off"); -like($standby_ts_stderr, qr/could not get commit timestamp data/, 'expected error when master turned feature off'); +is($standby_ts_stdout, '', + "standby gives no value when master turned feature off"); +like( + $standby_ts_stderr, + qr/could not get commit timestamp data/, + 'expected error when master turned feature off'); diff --git a/src/test/modules/commit_ts/t/003_standby_2.pl b/src/test/modules/commit_ts/t/003_standby_2.pl index 138cc43dc2b..d37ff182c4c 100644 --- a/src/test/modules/commit_ts/t/003_standby_2.pl +++ b/src/test/modules/commit_ts/t/003_standby_2.pl @@ -8,9 +8,10 @@ use Test::More tests => 4; use PostgresNode; my $bkplabel = 'backup'; -my $master = get_new_node('master'); +my $master = get_new_node('master'); $master->init(allows_streaming => 1); -$master->append_conf('postgresql.conf', qq{ +$master->append_conf( + 'postgresql.conf', qq{ track_commit_timestamp = on max_wal_senders = 5 wal_level = hot_standby @@ -29,20 +30,25 @@ for my $i (1 .. 10) $master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $master->restart; $master->safe_psql('postgres', 'checkpoint'); -my $master_lsn = $master->safe_psql('postgres', - 'select pg_current_xlog_location()'); +my $master_lsn = + $master->safe_psql('postgres', 'select pg_current_xlog_location()'); $standby->poll_query_until('postgres', qq{SELECT '$master_lsn'::pg_lsn <= pg_last_xlog_replay_location()}) - or die "slave never caught up"; + or die "slave never caught up"; $standby->safe_psql('postgres', 'checkpoint'); $standby->restart; -my ($psql_ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres', - qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}); +my ($psql_ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql( + 'postgres', +qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'} +); is($psql_ret, 3, 'expect error when getting commit timestamp after restart'); is($standby_ts_stdout, '', "standby does not return a value after restart"); -like($standby_ts_stderr, qr/could not get commit timestamp data/, 'expected err msg after restart'); +like( + $standby_ts_stderr, + qr/could not get commit timestamp data/, + 'expected err msg after restart'); $master->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $master->restart; @@ -54,5 +60,7 @@ $standby->poll_query_until('postgres', "SELECT pg_is_in_recovery() <> true"); $standby->safe_psql('postgres', "create table t11()"); my $standby_ts = $standby->safe_psql('postgres', - qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't11'}); -isnt($standby_ts, '', "standby gives valid value ($standby_ts) after promotion"); +qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't11'} +); +isnt($standby_ts, '', + "standby gives valid value ($standby_ts) after promotion"); |