Commit cf9038e9 authored by unknown's avatar unknown
Browse files

Fix for BUG##24415: Instance manager test im_daemon_life_cycle

fails randomly.

The problem was that the test case used command line tool (mysql)
without specifying connect_timeout argument. In some cases,
this lead to hanging of the test case.

The fix is to specify --connect_timeout=1 when starting mysql.

Also, the patch contains polishing and various cleanups to simplify
analyzing of the problems further.

The patch affects only test suite, no server codebase has been
touched.


mysql-test/lib/mtr_im.pl:
  Remember PID of the IM-spawner -- a process, that is
  used to fork IM-angel.
mysql-test/lib/mtr_io.pl:
  Trim \n from the PID.
mysql-test/lib/mtr_process.pl:
  Don't complain if it was IM-spawner, who died.
mysql-test/r/im_daemon_life_cycle.result:
  Update the result file.
mysql-test/r/im_life_cycle.result:
  Update the result file.
mysql-test/t/im_daemon_life_cycle.imtest:
  Polishing: add more comments, be more verbose.
mysql-test/t/im_life_cycle.imtest:
  Polishing: be more verbose.
mysql-test/t/im_utils.imtest:
  Polishing: be more verbose.
mysql-test/t/kill_n_check.sh:
  Log messages to the extrenal file so that they can be analyzed
  if test case failed.
mysql-test/t/wait_for_process.sh:
  Log messages to the extrenal file so that they can be analyzed
  if test case failed.
mysql-test/t/wait_for_socket.sh:
  Log messages to the extrenal file so that they can be analyzed
  if test case failed.
mysql-test/t/log.sh:
  Dummy script to facilitate logging from test-scripts.
mysql-test/t/utils.sh:
  A bunch of auxilary functions to facilitate logging.
parent 247428a1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -582,7 +582,7 @@ sub mtr_im_start($$) {
    mtr_add_arg($args, $opt);
  }

  $im->{'pid'} =
  $im->{'spawner_pid'} =
    mtr_spawn(
      $::exe_im,                        # path to the executable
      $args,                            # cmd-line args
@@ -593,7 +593,7 @@ sub mtr_im_start($$) {
      { append_log_file => 1 }          # append log files
      );

  unless ( $im->{'pid'} )
  unless ( $im->{'spawner_pid'} )
  {
    mtr_error('Could not start Instance Manager.')
  }
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ sub mtr_get_pid_from_file ($) {

    # Read pid number from file
    my $pid= <FILE>;
    chomp $pid;
    close FILE;

    return $pid if $pid=~ /^(\d+)/;
+6 −0
Original line number Diff line number Diff line
@@ -937,6 +937,12 @@ sub check_expected_crash_and_restart($)
      }
    }
  }

  if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
  {
    return;
  }

  mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");

}
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ instance_name status
mysqld1	online
mysqld2	offline
Killing the process...
Sleeping...
Waiting...
Success: the process was restarted.
Success: server is ready to accept connection on socket.

@@ -16,7 +16,7 @@ Success: server is ready to accept connection on socket.
START INSTANCE mysqld2;
Success: the process has been started.
Killing the process...
Sleeping...
Waiting...
Success: the process was restarted.
Success: server is ready to accept connection on socket.
SHOW INSTANCE STATUS mysqld1;
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
-- 1.1.6.
--------------------------------------------------------------------
Killing the process...
Sleeping...
Waiting...
Success: the process was restarted.
SHOW INSTANCES;
instance_name	status
@@ -52,7 +52,7 @@ mysqld2 offline
START INSTANCE mysqld2;
Success: the process has been started.
Killing the process...
Sleeping...
Waiting...
Success: the process was killed.

--------------------------------------------------------------------
Loading