MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:July 20 2009 4:51pm
Subject:bzr commit into mysql-5.4 branch (alik:2830) Bug#33472
View as plain text  
#At file:///mnt/raid/alik/MySQL/bzr/bug33472/azalea-bf-bug33472/ based on revid:alik@stripped

 2830 Alexander Nozdrin	2009-07-20
      Patch for Bug#33472 (Instance Manager ("mysqlmanager") still
      shows up in the start/stop script).
      
      The patch eliminates forgotten Instance Manager support
      from various places of the source code. Especially from
      the mysql.server script.

    modified:
      netware/BUILD/compile-netware-START
      scripts/make_binary_distribution.sh
      sql/mysqld.cc
      support-files/mysql.server.sh
=== modified file 'netware/BUILD/compile-netware-START'
--- a/netware/BUILD/compile-netware-START	2006-10-12 16:25:27 +0000
+++ b/netware/BUILD/compile-netware-START	2009-07-20 16:51:21 +0000
@@ -22,6 +22,5 @@ base_configs=" \
 	--enable-local-infile \
 	--with-extra-charsets=all \
 	--prefix=N:/mysql \
-	--without-mysqlmanager \
 	--without-man \
 	"

=== modified file 'scripts/make_binary_distribution.sh'
--- a/scripts/make_binary_distribution.sh	2009-04-14 21:07:28 +0000
+++ b/scripts/make_binary_distribution.sh	2009-07-20 16:51:21 +0000
@@ -342,7 +342,6 @@ BIN_FILES="extra/comp_err$BS extra/repla
   storage/myisam/myisamlog$BS storage/myisam/myisam_ftdump$BS \
   sql/mysqld$BS sql/mysqld-debug$BS \
   sql/mysql_tzinfo_to_sql$BS \
-  server-tools/instance-manager/mysqlmanager$BS \
   client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
   client/mysqlslap$BS \
   client/mysqldump$BS client/mysqlimport$BS \

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2009-07-10 12:31:32 +0000
+++ b/sql/mysqld.cc	2009-07-20 16:51:21 +0000
@@ -7877,10 +7877,7 @@ SHOW_VAR status_vars[]= {
 static void print_version(void)
 {
   set_server_version();
-  /*
-    Note: the instance manager keys off the string 'Ver' so it can find the
-    version from the output of 'mysqld --version', so don't change it!
-  */
+
   printf("%s  Ver %s for %s on %s (%s)\n",my_progname,
 	 server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
 }

=== modified file 'support-files/mysql.server.sh'
--- a/support-files/mysql.server.sh	2008-03-26 16:40:41 +0000
+++ b/support-files/mysql.server.sh	2009-07-20 16:51:21 +0000
@@ -53,13 +53,14 @@ datadir=
 # Negative numbers mean to wait indefinitely
 service_startup_timeout=900
 
+# Lock directory for RedHat / SuSE.
+lockdir='/var/lock/subsys'
+lock_file_path="$lockdir/mysql"
+
 # The following variables are only set for letting mysql.server find things.
 
 # Set some defaults
-pid_file=
-server_pid_file=
-use_mysqld_safe=1
-user=@MYSQLD_USER@
+mysqld_pid_file_path=
 if test -z "$basedir"
 then
   basedir=@prefix@
@@ -101,11 +102,14 @@ else
   }
 fi
 
-PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
+PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
 export PATH
 
 mode=$1    # start or stop
-shift
+
+[ $# -ge 1 ] && shift
+
+
 other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
            # Expected: "--skip-networking --skip-grant-tables"
            # They are not checked here, intentionally, as it is the resposibility
@@ -131,59 +135,50 @@ parse_server_arguments() {
       --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
 		    datadir_set=1
 	;;
-      --user=*)  user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-      --pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+      --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
       --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-      --use-mysqld_safe) use_mysqld_safe=1;;
-      --use-manager)     use_mysqld_safe=0;;
-    esac
-  done
-}
-
-parse_manager_arguments() {
-  for arg do
-    case "$arg" in
-      --pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-      --user=*)  user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
     esac
   done
 }
 
 wait_for_pid () {
-  verb="$1"
-  manager_pid="$2"  # process ID of the program operating on the pid-file
+  verb="$1"           # created | removed
+  pid="$2"            # process ID of the program operating on the pid-file
+  pid_file_path="$3" # path to the PID file.
+
   i=0
   avoid_race_condition="by checking again"
+
   while test $i -ne $service_startup_timeout ; do
 
     case "$verb" in
       'created')
         # wait for a PID-file to pop into existence.
-        test -s $pid_file && i='' && break
+        test -s "$pid_file_path" && i='' && break
         ;;
       'removed')
         # wait for this PID-file to disappear
-        test ! -s $pid_file && i='' && break
+        test ! -s "$pid_file_path" && i='' && break
         ;;
       *)
-        echo "wait_for_pid () usage: wait_for_pid created|removed manager_pid"
+        echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
         exit 1
         ;;
     esac
 
-    # if manager isn't running, then pid-file will never be updated
-    if test -n "$manager_pid"; then
-      if kill -0 "$manager_pid" 2>/dev/null; then
-        :  # the manager still runs
+    # if server isn't running, then pid-file will never be updated
+    if test -n "$pid"; then
+      if kill -0 "$pid" 2>/dev/null; then
+        :  # the server still runs
       else
-        # The manager may have exited between the last pid-file check and now.  
+        # The server may have exited between the last pid-file check and now.  
         if test -n "$avoid_race_condition"; then
           avoid_race_condition=""
           continue  # Check again.
         fi
 
         # there's nothing that will affect the file.
-        log_failure_msg "Manager of pid-file quit without updating file."
+        log_failure_msg "The server quit without updating PID file ($pid_file_path)."
         return 1  # not waiting any more.
       fi
     fi
@@ -191,6 +186,7 @@ wait_for_pid () {
     echo $echo_n ".$echo_c"
     i=`expr $i + 1`
     sleep 1
+
   done
 
   if test -z "$i" ; then
@@ -259,28 +255,16 @@ fi
 
 parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
 
-# Look for the pidfile 
-parse_manager_arguments `$print_defaults $extra_args manager`
-
 #
 # Set pid file if not given
 #
-if test -z "$pid_file"
-then
-  pid_file=$datadir/mysqlmanager-`@HOSTNAME@`.pid
-else
-  case "$pid_file" in
-    /* ) ;;
-    * )  pid_file="$datadir/$pid_file" ;;
-  esac
-fi
-if test -z "$server_pid_file"
+if test -z "$mysqld_pid_file_path"
 then
-  server_pid_file=$datadir/`@HOSTNAME@`.pid
+  mysqld_pid_file_path=$datadir/`@HOSTNAME@`.pid
 else
-  case "$server_pid_file" in
+  case "$mysqld_pid_file_path" in
     /* ) ;;
-    * )  server_pid_file="$datadir/$server_pid_file" ;;
+    * )  mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
   esac
 fi
 
@@ -291,53 +275,23 @@ case "$mode" in
     # Safeguard (relative paths, core dumps..)
     cd $basedir
 
-    manager=$bindir/mysqlmanager
-    if test -x $libexecdir/mysqlmanager
-    then
-      manager=$libexecdir/mysqlmanager
-    elif test -x $sbindir/mysqlmanager
-    then
-      manager=$sbindir/mysqlmanager
-    fi
-
     echo $echo_n "Starting MySQL"
-    if test -x $manager -a "$use_mysqld_safe" = "0"
-    then
-      if test -n "$other_args"
-      then
-        log_failure_msg "MySQL manager does not support options '$other_args'"
-        exit 1
-      fi
-      # Give extra arguments to mysqld with the my.cnf file. This script may
-      # be overwritten at next upgrade.
-      "$manager" \
-        --mysqld-safe-compatible \
-        --user="$user" \
-        --pid-file="$pid_file" >/dev/null 2>&1 &
-      wait_for_pid created $!; return_value=$?
-
-      # Make lock for RedHat / SuSE
-      if test -w /var/lock/subsys
-      then
-        touch /var/lock/subsys/mysqlmanager
-      fi
-      exit $return_value
-    elif test -x $bindir/mysqld_safe
+    if test -x $bindir/mysqld_safe
     then
       # Give extra arguments to mysqld with the my.cnf file. This script
       # may be overwritten at next upgrade.
-      pid_file=$server_pid_file
-      $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
-      wait_for_pid created $!; return_value=$?
+      $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
+      wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
 
       # Make lock for RedHat / SuSE
-      if test -w /var/lock/subsys
+      if test -w "$lockdir"
       then
-        touch /var/lock/subsys/mysql
+        touch "$lock_file_path"
       fi
+
       exit $return_value
     else
-      log_failure_msg "Couldn't find MySQL manager ($manager) or server ($bindir/mysqld_safe)"
+      log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
     fi
     ;;
 
@@ -345,32 +299,22 @@ case "$mode" in
     # Stop daemon. We use a signal here to avoid having to know the
     # root password.
 
-    # The RedHat / SuSE lock directory to remove
-    lock_dir=/var/lock/subsys/mysqlmanager
-
-    # If the manager pid_file doesn't exist, try the server's
-    if test ! -s "$pid_file"
+    if test -s "$mysqld_pid_file_path"
     then
-      pid_file=$server_pid_file
-      lock_dir=/var/lock/subsys/mysql
-    fi
-
-    if test -s "$pid_file"
-    then
-      mysqlmanager_pid=`cat $pid_file`
+      mysqld_pid=`cat "$mysqld_pid_file_path"`
       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 "$mysqlmanager_pid"; return_value=$?
+      kill $mysqld_pid
+      # mysqld should remove the pid file when it exits, so wait for it.
+      wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
 
-      # delete lock for RedHat / SuSE
-      if test -f $lock_dir
+      # Delete lock for RedHat / SuSE
+      if test -f "$lock_file_path"
       then
-        rm -f $lock_dir
+        rm -f "$lock_file_path"
       fi
       exit $return_value
     else
-      log_failure_msg "MySQL manager or server PID file could not be found!"
+      log_failure_msg "MySQL server PID file could not be found!"
     fi
     ;;
 
@@ -386,10 +330,10 @@ case "$mode" in
     ;;
 
   'reload'|'force-reload')
-    if test -s "$server_pid_file" ; then
-      read mysqld_pid <  $server_pid_file
+    if test -s "$mysqld_pid_file_path" ; then
+      read mysqld_pid <  "$mysqld_pid_file_path"
       kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
-      touch $server_pid_file
+      touch "$mysqld_pid_file_path"
     else
       log_failure_msg "MySQL PID file could not be found!"
       exit 1
@@ -397,8 +341,8 @@ case "$mode" in
     ;;
   'status')
     # First, check to see if pid file exists
-    if test -s "$server_pid_file" ; then 
-      read mysqld_pid < $server_pid_file
+    if test -s "$mysqld_pid_file_path" ; then 
+      read mysqld_pid < "$mysqld_pid_file_path"
       if kill -0 $mysqld_pid 2>/dev/null ; then 
         log_success_msg "MySQL running ($mysqld_pid)"
         exit 0
@@ -410,13 +354,8 @@ case "$mode" in
       # Try to find appropriate mysqld process
       mysqld_pid=`pidof $libexecdir/mysqld`
       if test -z $mysqld_pid ; then 
-        if test "$use_mysqld_safe" = "0" ; then 
-          lockfile=/var/lock/subsys/mysqlmanager
-        else
-          lockfile=/var/lock/subsys/mysql
-        fi 
-        if test -f $lockfile ; then 
-          log_failure_msg "MySQL is not running, but lock exists"
+        if test -f "$lock_file_path" ; then 
+          log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
           exit 2
         fi 
         log_failure_msg "MySQL is not running"
@@ -429,7 +368,8 @@ case "$mode" in
     ;;
     *)
       # usage
-      echo "Usage: $0  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
+      basename=`basename "$0"`
+      echo "Usage: $basename  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
       exit 1
     ;;
 esac


Attachment: [text/bzr-bundle] bzr/alik@sun.com-20090720165121-uhlah1t61aqi3w6o.bundle
Thread
bzr commit into mysql-5.4 branch (alik:2830) Bug#33472Alexander Nozdrin20 Jul