diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-01-08 17:32:09 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-01-11 13:35:38 -0500 |
commit | bbd3363e128daec0e70952c1bb2f12ab1f6f1292 (patch) | |
tree | 3713cabf22276c9d50b0f40acdde71d7272297fd /src/test/subscription/t/003_constraints.pl | |
parent | 4d41b2e0926548e338d20875729a55d41289f867 (diff) | |
download | postgresql-bbd3363e128daec0e70952c1bb2f12ab1f6f1292.tar.gz postgresql-bbd3363e128daec0e70952c1bb2f12ab1f6f1292.zip |
Refactor subscription tests to use PostgresNode's wait_for_catchup
This was nearly the same code. Extend wait_for_catchup to allow waiting
for pg_current_wal_lsn() and use that in the subscription tests. Also
change one use in the pg_rewind tests to use this.
Also remove some broken code in wait_for_catchup and
wait_for_slot_catchup. The error message in case the waiting failed
wanted to show the current LSN, but the way it was written never
worked. So since nobody ever cared, just remove it.
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/test/subscription/t/003_constraints.pl')
-rw-r--r-- | src/test/subscription/t/003_constraints.pl | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/test/subscription/t/003_constraints.pl b/src/test/subscription/t/003_constraints.pl index 06863aef84a..6f6805b952f 100644 --- a/src/test/subscription/t/003_constraints.pl +++ b/src/test/subscription/t/003_constraints.pl @@ -39,19 +39,14 @@ $node_subscriber->safe_psql('postgres', "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)" ); -# Wait for subscriber to finish initialization -my $caughtup_query = -"SELECT pg_current_wal_lsn() <= replay_lsn FROM pg_stat_replication WHERE application_name = '$appname';"; -$node_publisher->poll_query_until('postgres', $caughtup_query) - or die "Timed out while waiting for subscriber to catch up"; +$node_publisher->wait_for_catchup($appname); $node_publisher->safe_psql('postgres', "INSERT INTO tab_fk (bid) VALUES (1);"); $node_publisher->safe_psql('postgres', "INSERT INTO tab_fk_ref (id, bid) VALUES (1, 1);"); -$node_publisher->poll_query_until('postgres', $caughtup_query) - or die "Timed out while waiting for subscriber to catch up"; +$node_publisher->wait_for_catchup($appname); # Check data on subscriber my $result = $node_subscriber->safe_psql('postgres', @@ -69,8 +64,7 @@ $node_publisher->safe_psql('postgres', "DROP TABLE tab_fk CASCADE;"); $node_publisher->safe_psql('postgres', "INSERT INTO tab_fk_ref (id, bid) VALUES (2, 2);"); -$node_publisher->poll_query_until('postgres', $caughtup_query) - or die "Timed out while waiting for subscriber to catch up"; +$node_publisher->wait_for_catchup($appname); # FK is not enforced on subscriber $result = $node_subscriber->safe_psql('postgres', @@ -104,8 +98,7 @@ ALTER TABLE tab_fk_ref ENABLE REPLICA TRIGGER filter_basic_dml_trg; $node_publisher->safe_psql('postgres', "INSERT INTO tab_fk_ref (id, bid) VALUES (10, 10);"); -$node_publisher->poll_query_until('postgres', $caughtup_query) - or die "Timed out while waiting for subscriber to catch up"; +$node_publisher->wait_for_catchup($appname); # The row should be skipped on subscriber $result = $node_subscriber->safe_psql('postgres', |