]> granicus.if.org Git - postgresql/commitdiff
Avoid race condition in logical replication test
authorSimon Riggs <simon@2ndQuadrant.com>
Fri, 1 Sep 2017 13:55:44 +0000 (14:55 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Fri, 1 Sep 2017 13:55:44 +0000 (14:55 +0100)
Wait for slot to become inactive before continuing.

Author: Petr Jelinek

src/test/recovery/t/006_logical_decoding.pl

index 4a90e9ac7e2fa117c02edc6d6aadedde434a720d..8b35bc84381d03181dd417cbf3883024086250ae 100644 (file)
@@ -78,6 +78,11 @@ chomp($stdout_recv);
 is($stdout_recv, $expected,
        'got same expected output from pg_recvlogical decoding session');
 
+$node_master->poll_query_until('postgres',
+"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)"
+)
+  or die "slot never became inactive";
+
 $stdout_recv = $node_master->pg_recvlogical_upto(
        'postgres', 'test_slot', $endpos, 10,
        'include-xids'     => '0',