diff options
author | Amit Kapila <akapila@postgresql.org> | 2021-04-06 14:58:52 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2021-04-06 14:58:52 +0530 |
commit | 266b5673b4b6bed2e9ebfe73ca967f44d6dc0e6c (patch) | |
tree | ebb229011dd4739931fc30b6986d14a323936205 /src | |
parent | 9bc9b4609a246ded5caf3f3d4c0013a002ba2323 (diff) | |
download | postgresql-266b5673b4b6bed2e9ebfe73ca967f44d6dc0e6c.tar.gz postgresql-266b5673b4b6bed2e9ebfe73ca967f44d6dc0e6c.zip |
Fix the tests added by commit ac4645c015.
In the tests, after disabling the subscription, we were not waiting for
the replication connection to drop from the publisher. So when the test
was trying to use the same slot to fetch the messages via SQL API, it
sometimes gives an error that the replication slot is active for other
PID.
Per buildfarm.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/subscription/t/020_messages.pl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/subscription/t/020_messages.pl b/src/test/subscription/t/020_messages.pl index d9123ed3ef1..c8be26be736 100644 --- a/src/test/subscription/t/020_messages.pl +++ b/src/test/subscription/t/020_messages.pl @@ -34,6 +34,10 @@ $node_subscriber->safe_psql('postgres', # Ensure a transactional logical decoding message shows up on the slot $node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE"); +# wait for the replication connection to drop from the publisher +$node_publisher->poll_query_until('postgres', + 'SELECT COUNT(*) FROM pg_catalog.pg_stat_replication', 0); + $node_publisher->safe_psql('postgres', "SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')" ); @@ -85,6 +89,10 @@ $node_publisher->wait_for_catchup('tap_sub'); # ensure a non-transactional logical decoding message shows up on the slot $node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE"); +# wait for the replication connection to drop from the publisher +$node_publisher->poll_query_until('postgres', + 'SELECT COUNT(*) FROM pg_catalog.pg_stat_replication', 0); + $node_publisher->safe_psql('postgres', "INSERT INTO tab_test VALUES (1)"); my $message_lsn = $node_publisher->safe_psql('postgres', |