List:Commits« Previous MessageNext Message »
From:msvensson Date:March 30 2007 3:43pm
Subject:bk commit into 5.0 tree (msvensson:1.2437) BUG#25657
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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@stripped, 2007-03-30 15:43:36+02:00, msvensson@shellback.(none) +2 -0
  Bug#25657 mysql-test-run.pl kill itself under ActiveState perl
  - Read the pid from pidfile in order to be able to kill the real process
  instead of the pseudo process. Most platforms will have the same real_pid
  as pid
  - Kill using the real pid

  mysql-test/lib/mtr_process.pl@stripped, 2007-03-30 15:43:34+02:00,
msvensson@shellback.(none) +15 -10
    Kill using the "real_pid"

  mysql-test/mysql-test-run.pl@stripped, 2007-03-30 15:43:34+02:00,
msvensson@shellback.(none) +13 -4
    Read the pid from pidfile in order to be able to kill the real process
    instead of the pseudo process. Most platforms will have the same real_pid
    as pid

# 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:	msvensson
# Host:	shellback.(none)
# Root:	/home/msvensson/mysql/mysql-5.0-maint

--- 1.53/mysql-test/lib/mtr_process.pl	2007-03-30 15:43:45 +02:00
+++ 1.54/mysql-test/lib/mtr_process.pl	2007-03-30 15:43:45 +02:00
@@ -562,7 +562,7 @@
   # Return if no processes are defined
   return if ! @$spec;
 
-  #mtr_report("mtr_check_stop_servers");
+  mtr_verbose("mtr_check_stop_servers");
 
   mtr_ping_with_timeout(\@$spec);
 
@@ -605,7 +605,10 @@
   {
     if ( $srv->{'pid'} )
     {
-      $mysqld_pids{$srv->{'pid'}}= 1;
+       # Add the process pid to list of pids to kill
+       # if the process has a "real_pid" use it
+       $mysqld_pids{$srv->{'real_pid'} ?
+		    $srv->{'real_pid'} : $srv->{'pid'}}= 1;
     }
     else
     {
@@ -638,13 +641,9 @@
   # that for true Win32 processes, kill(0,$pid) will not return 1.
   # ----------------------------------------------------------------------
 
-  start_reap_all();                     # Avoid zombies
-
   my @mysqld_pids= keys %mysqld_pids;
   mtr_kill_processes(\@mysqld_pids);
 
-  stop_reap_all();                      # Get into control again
-
   # ----------------------------------------------------------------------
   # Now, we check if all we can find using kill(0,$pid) are dead,
   # and just assume the rest are. We cleanup socket and PID files.
@@ -654,14 +653,15 @@
     my $errors= 0;
     foreach my $srv ( @$spec )
     {
-      if ( $srv->{'pid'} )
+      my $pid= $srv->{'real_pid'} ? $srv->{'real_pid'} : $srv->{'pid'};
+      if ( $pid )
       {
-        if ( kill(0,$srv->{'pid'}) )
+        if ( kill(0, $pid) )
         {
           # FIXME In Cygwin there seem to be some fast reuse
           # of PIDs, so dying may not be the right thing to do.
           $errors++;
-          mtr_warning("can't kill process $srv->{'pid'}");
+          mtr_warning("can't kill process $pid");
         }
         else
         {
@@ -682,6 +682,8 @@
               mtr_warning("couldn't delete $file");
             }
           }
+	  # Reap the child
+	  waitpid($srv->{'pid'},&WNOHANG);
 	  $srv->{'pid'}= 0;
         }
       }
@@ -1063,7 +1065,10 @@
   {
     if ( -r $pidfile )
     {
-      return $pid;
+      # Read real pid from pidfile
+      my $real_pid= mtr_fromfile($pidfile);
+      mtr_verbose("pid: $pid, real_pid: $real_pid");
+      return $real_pid;
     }
 
     # Check if it died after the fork() was successful

--- 1.215/mysql-test/mysql-test-run.pl	2007-03-30 15:43:45 +02:00
+++ 1.216/mysql-test/mysql-test-run.pl	2007-03-30 15:43:45 +02:00
@@ -2549,10 +2549,16 @@
 sub mysqld_wait_started($){
   my $mysqld= shift;
 
-  my $res= sleep_until_file_created($mysqld->{'path_pid'},
-				    $mysqld->{'start_timeout'},
-				    $mysqld->{'pid'});
-  return $res == 0;
+  my $pid_from_pidfile=
+    sleep_until_file_created($mysqld->{'path_pid'},
+                             $mysqld->{'start_timeout'},
+                             $mysqld->{'pid'});
+
+  # On platforms with pseudo threads we need to save
+  # the real pid of mysqld read from pidfile
+  $mysqld->{'real_pid'}= $pid_from_pidfile;
+
+  return $pid_from_pidfile == 0;
 }
 
 
@@ -4047,6 +4053,7 @@
 
       push(@kill_pids,{
 		       pid      => $mysqld->{'pid'},
+		       real_pid => $mysqld->{'real_pid'},
 		       pidfile  => $mysqld->{'path_pid'},
 		       sockfile => $mysqld->{'path_sock'},
 		       port     => $mysqld->{'port'},
@@ -4253,6 +4260,7 @@
 
 	push(@kill_pids,{
 			 pid      => $mysqld->{'pid'},
+                         real_pid => $mysqld->{'real_pid'},
 			 pidfile  => $mysqld->{'path_pid'},
 			 sockfile => $mysqld->{'path_sock'},
 			 port     => $mysqld->{'port'},
@@ -4303,6 +4311,7 @@
 
 	push(@kill_pids,{
 			 pid      => $mysqld->{'pid'},
+                         real_pid => $mysqld->{'real_pid'},
 			 pidfile  => $mysqld->{'path_pid'},
 			 sockfile => $mysqld->{'path_sock'},
 			 port     => $mysqld->{'port'},
Thread
bk commit into 5.0 tree (msvensson:1.2437) BUG#25657msvensson30 Mar