Skip to content

Commit 266b567

Browse files
author
Amit Kapila
committed
Fix the tests added by commit ac4645c.
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.
1 parent 9bc9b46 commit 266b567

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/subscription/t/020_messages.pl

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
# Ensure a transactional logical decoding message shows up on the slot
3535
$node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE");
3636

37+
# wait for the replication connection to drop from the publisher
38+
$node_publisher->poll_query_until('postgres',
39+
'SELECT COUNT(*) FROM pg_catalog.pg_stat_replication', 0);
40+
3741
$node_publisher->safe_psql('postgres',
3842
"SELECT pg_logical_emit_message(true, 'pgoutput', 'a transactional message')"
3943
);
@@ -85,6 +89,10 @@
8589
# ensure a non-transactional logical decoding message shows up on the slot
8690
$node_subscriber->safe_psql('postgres', "ALTER SUBSCRIPTION tap_sub DISABLE");
8791

92+
# wait for the replication connection to drop from the publisher
93+
$node_publisher->poll_query_until('postgres',
94+
'SELECT COUNT(*) FROM pg_catalog.pg_stat_replication', 0);
95+
8896
$node_publisher->safe_psql('postgres', "INSERT INTO tab_test VALUES (1)");
8997

9098
my $message_lsn = $node_publisher->safe_psql('postgres',

0 commit comments

Comments
 (0)