Commit 4022d9dc authored by unknown's avatar unknown

Change 'mtr_kill_process' to only take three arguments. The last indicating...

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:
  Change 'mtr_kill_process' to only take three arguments. The last indicating max number of seconds to wait for process to be killed.
mysql-test/mysql-test-run.pl:
  Change 'mtr_kill_process' to only take three arguments. The last indicating max number of seconds to wait for process to be killed.
parent 890aac23
...@@ -25,7 +25,7 @@ sub sleep_until_file_created ($$$); ...@@ -25,7 +25,7 @@ sub sleep_until_file_created ($$$);
sub mtr_kill_processes ($); sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($); sub mtr_ping_with_timeout($);
sub mtr_ping_port ($); sub mtr_ping_port ($);
sub mtr_kill_process ($$$$); sub mtr_kill_process ($$$);
# static in C # static in C
sub spawn_impl ($$$$$$$$); sub spawn_impl ($$$$$$$$);
...@@ -933,17 +933,16 @@ sub mtr_kill_processes ($) { ...@@ -933,17 +933,16 @@ sub mtr_kill_processes ($) {
{ {
foreach my $sig (15, 9) 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 $pid= shift;
my $signal= shift; my $signal= shift;
my $retries= shift; my $timeout= shift; # Seconds to wait for process
my $timeout= shift;
my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt my $max_loop= $timeout*10; # Sleeping 0.1 between each kill attempt
while (1) while (1)
...@@ -952,7 +951,7 @@ sub mtr_kill_process ($$$$) { ...@@ -952,7 +951,7 @@ sub mtr_kill_process ($$$$) {
last unless kill (0, $pid) and $max_loop--; 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); select(undef, undef, undef, 0.1);
} }
......
...@@ -3407,7 +3407,7 @@ sub im_stop($) { ...@@ -3407,7 +3407,7 @@ sub im_stop($) {
# Try graceful shutdown. # 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. # Check that all processes died.
...@@ -3433,10 +3433,10 @@ sub im_stop($) { ...@@ -3433,10 +3433,10 @@ sub im_stop($) {
unless ($clean_shutdown) 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'}; 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 # 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 # will not stop them on shutdown. So, we should firstly try to end them
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment