diff options
Diffstat (limited to 'mysql-test/lib/mtr_process.pl')
-rw-r--r-- | mysql-test/lib/mtr_process.pl | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 779be3d7081..a3fb7ec0183 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -672,12 +672,15 @@ sub mtr_mysqladmin_shutdown { # Shutdown time must be high as slave may be in reconnect mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "shutdown"); + my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log"; # Start mysqladmin in paralell and wait for termination later my $pid= mtr_spawn($::exe_mysqladmin, $args, - "", $::path_manager_log, $::path_manager_log, "", + "", $path_mysqladmin_log, $path_mysqladmin_log, "", { append_log_file => 1 }); # Save the pid of the mysqladmin process $mysql_admin_pids{$pid}= 1; + + # We don't wait for termination of mysqladmin } # Wait for all the started mysqladmin to exit @@ -720,8 +723,6 @@ sub mtr_mysqladmin_shutdown { $timeout or mtr_debug("At least one server is still listening to its port"); - sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep - return $res; } @@ -821,8 +822,10 @@ sub sleep_until_file_created ($$$) { my $pidfile= shift; my $timeout= shift; my $pid= shift; + my $sleeptime= 100; # Milliseconds + my $loops= ($timeout * 1000) / $sleeptime; - for ( my $loop= 1; $loop <= $timeout; $loop++ ) + for ( my $loop= 1; $loop <= $loops; $loop++ ) { if ( -r $pidfile ) { @@ -835,16 +838,20 @@ sub sleep_until_file_created ($$$) { return 0; } - mtr_debug("Sleep 1 second waiting for creation of $pidfile"); + mtr_debug("Sleep $sleeptime milliseconds waiting for ". + "creation of $pidfile"); - if ( $loop % 60 == 0 ) + # Print extra message every 60 seconds + my $seconds= ($loop * $sleeptime) / 1000; + if ( $seconds > 1 and $seconds % 60 == 0 ) { - my $left= $timeout - $loop; - mtr_warning("Waited $loop seconds for $pidfile to be created, " . + my $left= $timeout - $seconds; + mtr_warning("Waited $seconds seconds for $pidfile to be created, " . "still waiting for $left seconds..."); } - sleep(1); + # Millisceond sleep emulated with select + select(undef, undef, undef, ($sleeptime/1000)); } return 0; |