Commit 312c4693 authored by unknown's avatar unknown
Browse files

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 f2d51019
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -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);
  }
+3 −3
Original line number Diff line number Diff line
@@ -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