MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:June 19 2006 10:15am
Subject:bk commit into 5.0 tree (anozdrin:1.2170)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2170 06/06/19 14:15:26 anozdrin@stripped +2 -0
  Small fix for test suite:
    - fix for IM stopping routine;
    - polishing.

  mysql-test/mysql-test-run.pl
    1.97 06/06/19 14:15:22 anozdrin@stripped +48 -6
    1. Fix stopping of IM running as a daemon -- after death of the main IM
    process, we should wait for the IM angel to die.
    2. Polishing -- be more verbose in debug mode.

  mysql-test/lib/mtr_process.pl
    1.33 06/06/19 14:15:22 anozdrin@stripped +13 -4
    Polishing: make mtr_kill_process() more verbose in debug mode.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	anozdrin
# Host:	booka
# Root:	/home/alik/MySQL/devel/5.0-rt-bug18023

--- 1.32/mysql-test/lib/mtr_process.pl	2006-05-06 13:57:53 +04:00
+++ 1.33/mysql-test/lib/mtr_process.pl	2006-06-19 14:15:22 +04:00
@@ -890,19 +890,28 @@ sub mtr_kill_processes ($) {
 sub mtr_kill_process ($$$$) {
   my $pid= shift;
   my $signal= shift;
-  my $retries= shift;
+  my $total_retries= shift;
   my $timeout= shift;
 
-  while (1)
+  for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt)
   {
+    mtr_debug("Sending $signal to $pid...");
+
     kill($signal, $pid);
 
-    last unless kill (0, $pid) and $retries--;
+    unless (kill (0, $pid))
+    {
+      mtr_debug("Process $pid died.");
+      return;
+    }
 
-    mtr_debug("Sleep $timeout second waiting for processes to die");
+    mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
 
     sleep($timeout);
   }
+
+  mtr_debug("Process $pid is still alive after $total_retries " .
+            "of sending signal $signal.");
 }
 
 ##############################################################################

--- 1.96/mysql-test/mysql-test-run.pl	2006-05-29 11:06:02 +04:00
+++ 1.97/mysql-test/mysql-test-run.pl	2006-06-19 14:15:22 +04:00
@@ -2843,22 +2843,58 @@ sub im_stop($) {
 
   # Try graceful shutdown.
 
+  mtr_debug("IM-main pid: $instance_manager->{'pid'}");
+  mtr_debug("Stopping IM-main...");
+
   mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1);
 
+  # If necessary, wait for angel process to die.
+
+  if (defined $instance_manager->{'angel_pid'})
+  {
+    mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}");
+    mtr_debug("Waiting for IM-angel to die...");
+
+    my $total_attempts= 10;
+
+    for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
+    {
+      unless (kill (0, $instance_manager->{'angel_pid'}))
+      {
+        mtr_debug("IM-angel died.");
+        last;
+      }
+
+      sleep(1);
+    }
+  }
+
   # Check that all processes died.
 
   my $clean_shutdown= 0;
 
   while (1)
   {
-    last if kill (0, $instance_manager->{'pid'});
+    if (kill (0, $instance_manager->{'pid'}))
+    {
+      mtr_debug("IM-main is still alive.");
+      last;
+    }
 
-    last if (defined $instance_manager->{'angel_pid'}) &&
-            kill (0, $instance_manager->{'angel_pid'});
+    if (defined $instance_manager->{'angel_pid'} &&
+        kill (0, $instance_manager->{'angel_pid'}))
+    {
+      mtr_debug("IM-angel is still alive.");
+      last;
+    }
 
     foreach my $pid (@mysqld_pids)
     {
-      last if kill (0, $pid);
+      if (kill (0, $pid))
+      {
+        mtr_debug("Guarded mysqld ($pid) is still alive.");
+        last;
+      }
     }
 
     $clean_shutdown= 1;
@@ -2869,15 +2905,21 @@ sub im_stop($) {
 
   unless ($clean_shutdown)
   {
-    mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
-      if defined $instance_manager->{'angel_pid'};
+
+    if (defined $instance_manager->{'angel_pid'})
+    {
+      mtr_debug("Killing IM-angel...");
+      mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
+    }
     
+    mtr_debug("Killing IM-main...");
     mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1);
 
     # 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
     # legally.
 
+    mtr_debug("Killing guarded mysqld(s)...");
     mtr_kill_processes(\@mysqld_pids);
 
     # Complain in error log so that a warning will be shown.
Thread
bk commit into 5.0 tree (anozdrin:1.2170)Alexander Nozdrin19 Jun