Bug#21721 Test suite does not start with NDB, hangs forever; problem around "ndb_mgmd"

 - Wait for ndb_mgmd with timeout
parent f19bdd99
...@@ -1955,6 +1955,23 @@ sub mysqld_wait_started($){ ...@@ -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 ($) { sub ndb_mgmd_start ($) {
my $cluster= shift; my $cluster= shift;
...@@ -1975,13 +1992,12 @@ sub ndb_mgmd_start ($) { ...@@ -1975,13 +1992,12 @@ sub ndb_mgmd_start ($) {
"", "",
{ append_log_file => 1 }); { append_log_file => 1 });
# FIXME Should not be needed # FIXME Should not be needed
# Unfortunately the cluster nodes will fail to start # Unfortunately the cluster nodes will fail to start
# if ndb_mgmd has not started properly # 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 # Remember pid of ndb_mgmd
...@@ -2046,7 +2062,7 @@ sub ndbcluster_start ($$) { ...@@ -2046,7 +2062,7 @@ sub ndbcluster_start ($$) {
mtr_error("Cluster '$cluster->{'name'}' already started"); 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++ ) for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment