From 946f0c839acc70cfd487b7bcda7b53863f4c446c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 May 2006 16:28:08 +0200 Subject: [PATCH] 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 --- mysql-test/lib/mtr_process.pl | 3 ++- mysql-test/mysql-test-run.pl | 42 +++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 275f74c33d9..93c84bad16c 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -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 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index eddacab44a7..48feed5054f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -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'})) - { - mtr_report("Failed to create 'cluster/apply_status' table"); - report_failure_and_restart($tinfo); - return; - } + if ( $tinfo->{'slave_num'} and + $clusters->[0]->{'pid'} and + $slave->[0]->{'pid'} ) + { + # Slaves are started, test needs cluster, slave mysqld started + workaround_hang_in_select($tinfo, $slave->[0]); } }