List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:March 14 2008 6:21pm
Subject:bk commit into 5.0 tree (cmiller:1.2586) BUG#30378
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller.  When cmiller 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, 2008-03-14 14:21:00-04:00, cmiller@stripped +1 -0
  Bug#30378: mysql.server needs to skip wait_for_pid() when mysqld \
  	isn't running
  
  Pass the process id of the manager as a parameter to "wait_for_pid"
  and if the manager isn't running, then do not continue to wait.
  
  Also, capture the error message of our process-existence test, 
  "kill -0", as we expect errors and shouldn't pass them to the user.  
  Additionally, be a bit more descriptive of what the problem is.

  support-files/mysql.server.sh@stripped, 2008-03-14 14:20:58-04:00, cmiller@stripped +26 -3
    Test that the PID-file's manager is running while we're waiting for
    something to happen with the pid-file.
    
    Capture the error message of our process-existence test, "kill -0",
    as we expect errors and shouldn't pass them to the user.
    Additionally, be a bit more descriptive of what the problem is.

diff -Nrup a/support-files/mysql.server.sh b/support-files/mysql.server.sh
--- a/support-files/mysql.server.sh	2007-11-05 11:46:23 -05:00
+++ b/support-files/mysql.server.sh	2008-03-14 14:20:58 -04:00
@@ -150,19 +150,42 @@ parse_manager_arguments() {
 }
 
 wait_for_pid () {
+  verb="$1"
+  manager_pid="$2"  # process ID of the program operating on the pid-file
   i=0
   while test $i -ne $service_startup_timeout ; do
     sleep 1
     case "$1" in
       'created')
+        # wait for a PID-file to pop into existence.
         test -s $pid_file && i='' && break
-        kill -0 $2 || break # if the program goes away, stop waiting
+
+        # though, if the server dies, it never will be created.
+        if kill -0 "$manager_pid" 2>/dev/null; then
+          :  # the creator still runs
+        else
+          # new process doesn't exist
+          log_failure_msg "Server quit before creating the PID file"
+          return 1  # not waiting any more.
+        fi
         ;;
       'removed')
+        # wait for this PID-file to disappear
         test ! -s $pid_file && i='' && break
+
+        # though if manager isn't running, then it will never be removed
+        if test -n "$manager_pid"; then
+          if kill -0 "$manager_pid" 2>/dev/null; then
+            :   # the remover still runs
+          else
+            # there's nothing that will remove the file.
+            log_failure_msg "Manager of the PID file isn't running"
+            return 1  # not waiting any more.
+          fi
+        fi
         ;;
       *)
-        echo "wait_for_pid () usage: wait_for_pid created|removed"
+        echo "wait_for_pid () usage: wait_for_pid created|removed manager_pid"
         exit 1
         ;;
     esac
@@ -335,7 +358,7 @@ case "$mode" in
       echo $echo_n "Shutting down MySQL"
       kill $mysqlmanager_pid
       # mysqlmanager should remove the pid_file when it exits, so wait for it.
-      wait_for_pid removed; return_value=$?
+      wait_for_pid removed "$mysqlmanager_pid"; return_value=$?
 
       # delete lock for RedHat / SuSE
       if test -f $lock_dir
Thread
bk commit into 5.0 tree (cmiller:1.2586) BUG#30378Chad MILLER14 Mar