Commit abc4c3dc authored by unknown's avatar unknown
Browse files

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.
parent 5ba4f53c
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -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++ )
  {