diff options
Diffstat (limited to 'src/test/modules/commit_ts/t/002_standby.pl')
-rw-r--r-- | src/test/modules/commit_ts/t/002_standby.pl | 34 |
1 files changed, 21 insertions, 13 deletions
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'); |