From a25cc0b9334b715dc2041b53c6794d74f4253732 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Sun, 11 Jun 2006 11:28:11 +0200 Subject: [PATCH] Change 'mtr_kill_process' to only take three arguments. The last indicating max number of seconds to wait for process to be killed. Leave it to the implementation of 'mtr_kill_process' how long to wait between each attempt to kill/detect if process has been killed. --- mysql-test/lib/mtr_process.pl | 11 +++++------ mysql-test/mysql-test-run.pl | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 307cc552b54..9db5c670fce 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -25,7 +25,7 @@ sub sleep_until_file_created ($$$); sub mtr_kill_processes ($); sub mtr_ping_with_timeout($); sub mtr_ping_port ($); -sub mtr_kill_process ($$$$); +sub mtr_kill_process ($$$); # static in C sub spawn_impl ($$$$$$$$); @@ -933,17 +933,16 @@ sub mtr_kill_processes ($) { { foreach my $sig (15, 9) { - last if mtr_kill_process($pid, $sig, 10, 1); + last if mtr_kill_process($pid, $sig, 10); } } } -sub mtr_kill_process ($$$$) { +sub mtr_kill_process ($$$) { my $pid= shift; my $signal= shift; - my $retries= shift; - my $timeout= shift; + my $timeout= shift; # Seconds to wait for process my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt while (1) @@ -952,7 +951,7 @@ sub mtr_kill_process ($$$$) { last unless kill (0, $pid) and $max_loop--; - mtr_verbose("Sleep 0.1 second waiting for processes to die"); + mtr_verbose("Sleep 0.1 second waiting for processes $pid to die"); select(undef, undef, undef, 0.1); } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ddd86eb2e86..499dc8ace1c 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3407,7 +3407,7 @@ sub im_stop($) { # Try graceful shutdown. - mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1); + mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10); # Check that all processes died. @@ -3433,10 +3433,10 @@ sub im_stop($) { unless ($clean_shutdown) { - mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1) + mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10) if defined $instance_manager->{'angel_pid'}; - mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1); + mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10); # Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM # will not stop them on shutdown. So, we should firstly try to end them