List:Commits« Previous MessageNext Message »
From:tomas Date:March 30 2006 12:19pm
Subject:bk commit into 5.1 tree (tomas:1.2000) BUG#6061
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.2000 06/03/30 12:18:56 tomas@stripped +1 -0
  Bug #6061 mysql-log-rotate script - error logging doesn't use new file

  scripts/mysqld_safe.sh
    1.80 06/03/30 12:18:48 tomas@stripped +43 -13
    Bug #6061 mysql-log-rotate script - error logging doesn't use new file

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/wl2325-alcatel

--- 1.79/scripts/mysqld_safe.sh	2005-07-19 20:05:45 +02:00
+++ 1.80/scripts/mysqld_safe.sh	2006-03-30 12:18:48 +02:00
@@ -45,6 +45,11 @@
         exit 1
 }
 
+shell_quote_string() {
+  # This sed command makes sure that any special chars are quoted,
+  # so the arg gets passed exactly to the server.
+  echo "$1" | sed -e 's,\([^a-zA-Z0-9/_.=-]\),\\\1,g'
+}
 
 parse_arguments() {
   # We only need to pass arguments through to the server if we don't
@@ -96,9 +101,7 @@
       *)
         if test -n "$pick_args"
         then
-          # This sed command makes sure that any special chars are quoted,
-          # so the arg gets passed exactly to the server.
-          args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
+          append_arg_to_args "$arg"
         fi
         ;;
     esac
@@ -201,6 +204,14 @@
   print_defaults="my_print_defaults"
 fi
 
+append_arg_to_args () {
+  args="$args "`shell_quote_string "$1"`
+}
+
+prepend_arg_to_args () {
+  args=`shell_quote_string "$1"`" $args"
+}
+
 args=
 SET_USER=2
 parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
@@ -241,15 +252,30 @@
     * )  pid_file="$DATADIR/$pid_file" ;;
   esac
 fi
-test -z "$err_log"  && err_log=$DATADIR/`@HOSTNAME@`.err
 
+if [ -z "$err_log" ]
+then
+  # Note: --log-error is not given to mysqld, because it was not specified on
+  # command line / options file.
+  err_log=$DATADIR/`@HOSTNAME@`.err
+else
+  case "$err_log" in
+    /* ) ;;
+    * ) err_log="$DATADIR/$err_log" ;;
+  esac
+
+  # Pass this option along to mysqld, so that the error log can be rotated
+  # by FLUSH LOGS
+  append_arg_to_args "--log-error=$err_log"
+fi
+  
 if test -n "$mysql_unix_port"
 then
-  args="--socket=$mysql_unix_port $args"
+  prepend_arg_to_args="--socket=$mysql_unix_port $args"
 fi
 if test -n "$mysql_tcp_port"
 then
-  args="--port=$mysql_tcp_port $args"
+  prepend_arg_to_args="--port=$mysql_tcp_port $args"
 fi
 
 if test $niceness -eq 0
@@ -316,7 +342,7 @@
   if test -n "$open_files"
   then
     ulimit -n $open_files
-    args="--open-files-limit=$open_files $args"
+    prepend_arg_to_args "--open-files-limit=$open_files"
   fi
   if test -n "$core_file_size"
   then
@@ -374,12 +400,16 @@
 while true
 do
   rm -f $safe_mysql_unix_port $pid_file	# Some extra safety
-  if test -z "$args"
-  then
-    $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
-  else
-    eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
-  fi
+
+  cmd=
+  for i in "$NOHUP_NICENESS" "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" "--datadir=$DATADIR" "$USER_OPTION" "--pid-file=$pid_file" @MYSQLD_DEFAULT_SWITCHES@
+  do
+    cmd="$cmd "`shell_quote_string "$i"`
+  done
+  cmd="$cmd $args >> "`shell_quote_string "$err_log"`" 2>&1"
+  #echo "Running mysqld: [$cmd]"
+  eval "$cmd"
+
   if test ! -f $pid_file		# This is removed if normal shutdown
   then
     echo "STOPPING server from pid file $pid_file"
Thread
bk commit into 5.1 tree (tomas:1.2000) BUG#6061tomas30 Mar