Commit 946f0c83 authored by unknown's avatar unknown
Browse files

Wait until first mysqld in slave cluster has created cluster/apply_status.ndb,...

Wait until first mysqld in slave cluster has created cluster/apply_status.ndb, put workaround in function workaround_hang_in_select
Add verbose printouts


mysql-test/lib/mtr_process.pl:
  Add verbose printouts
mysql-test/mysql-test-run.pl:
  Wait until first mysqld in slave cluster has created cluster/apply_status.ndb, put workaround in function workaround_hang_in_select
parent fe7751cb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -539,6 +539,7 @@ sub mtr_check_stop_servers ($) {
      $ret_pid= waitpid($srv->{'pid'},&WNOHANG);
      if ($ret_pid == $srv->{'pid'})
      {
	mtr_verbose("Catched exit of process $ret_pid");
	$srv->{'pid'}= 0;
      }
      else
@@ -754,7 +755,7 @@ sub mtr_ping_with_timeout($) {
      $res= 1;                          # We are optimistic
      if ( $srv->{'pid'} and mtr_ping_port($srv->{'port'}) )
      {
        mtr_report("waiting for process $srv->{'pid'} to stop ".
        mtr_verbose("waiting for process $srv->{'pid'} to stop ".
		   "using port $srv->{'port'}");

	# Millisceond sleep emulated with select
+28 −14
Original line number Diff line number Diff line
@@ -1655,7 +1655,7 @@ sub ndb_mgmd_start ($) {
  mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");


  my $path_ndb_mgmd_log= "$opt_vardir/log/$cluster->{'name'}_ndb_mgmd.log";
  my $path_ndb_mgmd_log= "$opt_vardir/log/\l$cluster->{'name'}_ndb_mgmd.log";
  $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
		  $path_ndb_mgmd_log,
		  $path_ndb_mgmd_log,
@@ -1686,7 +1686,7 @@ sub ndbd_start ($$$) {
  mtr_add_arg($args, "$extra_args");


  my $path_ndbd_log= "$opt_vardir/log/$cluster->{'name'}_ndbd_$idx.log";
  my $path_ndbd_log= "$opt_vardir/log/\l$cluster->{'name'}_ndbd_$idx.log";
  $pid= mtr_spawn($exe_ndbd, $args, "",
		  $path_ndbd_log,
		  $path_ndbd_log,
@@ -3082,6 +3082,24 @@ sub run_testcase_stop_servers($) {
  }
}

sub workaround_hang_in_select($$) {
  my $tinfo= shift;
  my $mysqld= shift;

  # Wait until mysqld has started and created apply_status table
  # FIXME this is a workaround for mysqld not being able to shutdown
  # before having connected to ndb_mgmd

  if ( ! sleep_until_file_created("$mysqld->{'path_myddir'}/cluster/apply_status.ndb",
				  $mysqld->{'start_timeout'},
				  $mysqld->{'pid'}))
  {
    mtr_report("Failed to create 'cluster/apply_status' table");
    report_failure_and_restart($tinfo);
    return;
  }
}


sub run_testcase_start_servers($) {
  my $tinfo= shift;
@@ -3178,19 +3196,15 @@ sub run_testcase_start_servers($) {
  if ( $clusters->[0]->{'pid'} and $master->[1]->{'pid'} )
  {
    # Test needs cluster, extra mysqld started
    # Wait until it has started and created apply_status table
    # FIXME this is a workaround for mysqld not being able to shutdown
    # before having connected to ndb_mgmd
    workaround_hang_in_select($tinfo, $master->[1]);
  }

    if ( ! sleep_until_file_created(
		"$master->[1]->{'path_myddir'}/cluster/apply_status.ndb",
				    $master->[1]->{'start_timeout'},
				    $master->[1]->{'pid'}))
  if ( $tinfo->{'slave_num'}  and
       $clusters->[0]->{'pid'} and
       $slave->[0]->{'pid'} )
  {
      mtr_report("Failed to create 'cluster/apply_status' table");
      report_failure_and_restart($tinfo);
      return;
    }
    # Slaves are started, test needs cluster, slave mysqld started
    workaround_hang_in_select($tinfo, $slave->[0]);
  }
}