]> granicus.if.org Git - postgresql/commitdiff
Fix timing issue in new subscription truncate test
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 7 Apr 2018 16:57:53 +0000 (12:57 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 7 Apr 2018 16:57:53 +0000 (12:57 -0400)
We need to wait for the initial sync of all subscriptions.  On
some (faster?) machines, this didn't make a difference, but
the (slower?) buildfarm machines are upset.

src/test/subscription/t/010_truncate.pl

index 8ea4ab624f02150649378e31417c00dcc2bd9171..fe9e0b9ec7136e7826fbc45b81ef84dba0faad9c 100644 (file)
@@ -61,7 +61,11 @@ $node_subscriber->safe_psql('postgres',
 $node_subscriber->safe_psql('postgres',
        "CREATE SUBSCRIPTION sub3 CONNECTION '$publisher_connstr application_name=sub3' PUBLICATION pub3");
 
-$node_publisher->wait_for_catchup('sub1');
+# Wait for initial sync of all subscriptions
+my $synced_query =
+"SELECT count(1) = 0 FROM pg_subscription_rel WHERE srsubstate NOT IN ('r', 's');";
+$node_subscriber->poll_query_until('postgres', $synced_query)
+  or die "Timed out while waiting for subscriber to synchronize data";
 
 # insert data to truncate