From abc4c3dc1d77cb801d9a13c9feb33bf970eeba3f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 Aug 2006 10:28:48 +0200 Subject: [PATCH] Bug#21721 Test suite does not start with NDB, hangs forever; problem around "ndb_mgmd" - Wait for ndb_mgmd with timeout mysql-test/mysql-test-run.pl: Add new function 'ndb_mgmd_wait_started' that will wait with timeout until ndb_mgmd has been started Don't bother to save the return value from 'ndb_mgmd_start' in local var as it's not used. --- mysql-test/mysql-test-run.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6865cd55398..c949c2e1966 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1955,6 +1955,23 @@ sub mysqld_wait_started($){ } +sub ndb_mgmd_wait_started($) { + my ($cluster)= @_; + + my $retries= 100; + while (ndbcluster_wait_started($cluster, "--no-contact") and + $retries) + { + # Millisceond sleep emulated with select + select(undef, undef, undef, (0.1)); + + $retries--; + } + + return $retries == 0; + +} + sub ndb_mgmd_start ($) { my $cluster= shift; @@ -1975,13 +1992,12 @@ sub ndb_mgmd_start ($) { "", { append_log_file => 1 }); - # FIXME Should not be needed # Unfortunately the cluster nodes will fail to start # if ndb_mgmd has not started properly - while (ndbcluster_wait_started($cluster, "--no-contact")) + if (ndb_mgmd_wait_started($cluster)) { - select(undef, undef, undef, 0.1); + mtr_error("Failed to wait for start of ndb_mgmd"); } # Remember pid of ndb_mgmd @@ -2046,7 +2062,7 @@ sub ndbcluster_start ($$) { mtr_error("Cluster '$cluster->{'name'}' already started"); } - my $pid= ndb_mgmd_start($cluster); + ndb_mgmd_start($cluster); for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ ) {