From bc89c92c3779948968f058c46ea8ec98117f50d1 Mon Sep 17 00:00:00 2001 From: "tim@siva.hindu.god" <> Date: Wed, 10 May 2006 11:33:36 -0600 Subject: [PATCH 1/4] Bug #6061 mysql-log-rotate script - error logging doesn't use new file - Fix mysqld_safe so that it always passes correct --log-error argument to mysqld - A few other minor clean-ups to mysqld_safe --- scripts/mysqld_safe.sh | 68 ++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 83bc8ce8954..744a4791307 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -31,7 +31,6 @@ Usage: $0 [OPTIONS] --defaults-file=FILE Use the specified defaults file --defaults-extra-file=FILE Also use defaults from the specified file --ledir=DIRECTORY Look for mysqld in the specified directory - --log-error=FILE Log errors to the specified log file --open-files-limit=LIMIT Limit the number of open files --core-file-size=LIMIT Limit core files to the specified size --timezone=TZ Set the system timezone @@ -46,6 +45,11 @@ EOF 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 @@ -69,14 +73,14 @@ parse_arguments() { --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;; - # these two might have been set in a [mysqld_safe] section of my.cnf + # these might have been set in a [mysqld_safe] section of my.cnf # they are added to mysqld command line to override settings from my.cnf + --log-error=*) err_log=`echo "$arg" | sed -e "s;--log-error=;;"` ;; --socket=*) mysql_unix_port=`echo "$arg" | sed -e "s;--socket=;;"` ;; --port=*) mysql_tcp_port=`echo "$arg" | sed -e "s;--port=;;"` ;; # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])! --ledir=*) ledir=`echo "$arg" | sed -e "s;--ledir=;;"` ;; - --log-error=*) err_log=`echo "$arg" | sed -e "s;--log-error=;;"` ;; --open-files-limit=*) open_files=`echo "$arg" | sed -e "s;--open-files-limit=;;"` ;; --core-file-size=*) core_file_size=`echo "$arg" | sed -e "s;--core-file-size=;;"` ;; --timezone=*) TZ=`echo "$arg" | sed -e "s;--timezone=;;"` ; export TZ; ;; @@ -97,9 +101,7 @@ parse_arguments() { *) 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 @@ -194,6 +196,10 @@ else print_defaults="my_print_defaults" fi +append_arg_to_args () { + args="$args "`shell_quote_string "$1"` +} + args= SET_USER=2 parse_arguments `$print_defaults $defaults --loose-verbose mysqld server` @@ -239,15 +245,39 @@ else * ) pid_file="$DATADIR/$pid_file" ;; esac fi -test -z "$err_log" && err_log=$DATADIR/`@HOSTNAME@`.err +append_arg_to_args "--pid-file=$pid_file" + +if [ -n "$err_log" ] +then + # mysqld adds ".err" if there is no extension on the --log-err + # argument; must match that here, or mysqld_safe will write to a + # different log file than mysqld + + # mysqld does not add ".err" to "--log-error=foo."; it considers a + # trailing "." as an extension + if expr "$err_log" : '.*\.[^/]*$' > /dev/null + then + : + else + err_log="$err_log".err + fi + + case "$err_log" in + /* ) ;; + * ) err_log="$DATADIR/$err_log" ;; + esac +else + err_log=$DATADIR/`@HOSTNAME@`.err +fi +append_arg_to_args "--log-error=$err_log" if test -n "$mysql_unix_port" then - args="--socket=$mysql_unix_port $args" + append_arg_to_args "--socket=$mysql_unix_port" fi if test -n "$mysql_tcp_port" then - args="--port=$mysql_tcp_port $args" + append_arg_to_args "--port=$mysql_tcp_port" fi if test $niceness -eq 0 @@ -314,7 +344,7 @@ then if test -n "$open_files" then ulimit -n $open_files - args="--open-files-limit=$open_files $args" + append_arg_to_args "--open-files-limit=$open_files" fi if test -n "$core_file_size" then @@ -372,12 +402,18 @@ echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log 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="$NOHUP_NICENESS" + + for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \ + "--datadir=$DATADIR" "$USER_OPTION" + 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" From 3def02edd170e0e308442f65fdde1eb282bba8d4 Mon Sep 17 00:00:00 2001 From: "reggie@big_geek." <> Date: Thu, 11 May 2006 11:06:35 -0500 Subject: [PATCH 2/4] bringing handlerton-win.cc back after incorrectly deleteing it. It is not needed for 5.1 or later but is used by 5.0 --- sql/handlerton-win.cc | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sql/handlerton-win.cc diff --git a/sql/handlerton-win.cc b/sql/handlerton-win.cc new file mode 100644 index 00000000000..9ce4eab2444 --- /dev/null +++ b/sql/handlerton-win.cc @@ -0,0 +1,72 @@ +#include "mysql_priv.h" + +extern handlerton heap_hton; +extern handlerton myisam_hton; +extern handlerton myisammrg_hton; +extern handlerton binlog_hton; +#ifdef WITH_INNOBASE_STORAGE_ENGINE +extern handlerton innobase_hton; +#endif +#ifdef WITH_BERKELEY_STORAGE_ENGINE +extern handlerton berkeley_hton; +#endif +#ifdef WITH_EXAMPLE_STORAGE_ENGINE +extern handlerton example_hton; +#endif +#ifdef WITH_ARCHIVE_STORAGE_ENGINE +extern handlerton archive_hton; +#endif +#ifdef WITH_CSV_STORAGE_ENGINE +extern handlerton tina_hton; +#endif +#ifdef WITH_BLACKHOLE_STORAGE_ENGINE +extern handlerton blackhole_hton; +#endif +#ifdef WITH_FEDERATED_STORAGE_ENGINE +extern handlerton federated_hton; +#endif +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE +extern handlerton ndbcluster_hton; +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE +extern handlerton partition_hton; +#endif + +/* + This array is used for processing compiled in engines. +*/ +handlerton *sys_table_types[]= +{ + &heap_hton, + &myisam_hton, +#ifdef WITH_INNOBASE_STORAGE_ENGINE + &innobase_hton, +#endif +#ifdef WITH_BERKELEY_STORAGE_ENGINE + &berkeley_hton, +#endif +#ifdef WITH_EXAMPLE_STORAGE_ENGINE + &example_hton, +#endif +#ifdef WITH_ARCHIVE_STORAGE_ENGINE + &archive_hton, +#endif +#ifdef WITH_CSV_STORAGE_ENGINE + &tina_hton, +#endif +#ifdef WITH_BLACKHOLE_STORAGE_ENGINE + &blackhole_hton, +#endif +#ifdef WITH_FEDERATED_STORAGE_ENGINE + &federated_hton, +#endif +#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE + &ndbcluster_hton, +#endif +#ifdef WITH_PARTITION_STORAGE_ENGINE + &partition_hton, +#endif + &myisammrg_hton, + &binlog_hton, + NULL +}; From 67a692f99892803d0f44cc6cf37c7718bc6acc31 Mon Sep 17 00:00:00 2001 From: "reggie@big_geek." <> Date: Thu, 11 May 2006 11:29:08 -0500 Subject: [PATCH 3/4] performing a set of bk mv on each CMakeLists.txt file to try and restore the mixed case filenames since this seems to be required with Cmake 2.4 beta 1. This is being pushed to a private tree and tested before being sent to the mainline. --- cmakelists.txt => CMakeLists.txt | 0 client/{cmakelists.txt => CMakeLists.txt} | 0 dbug/{cmakelists.txt => CMakeLists.txt} | 0 extra/{cmakelists.txt => CMakeLists.txt} | 0 extra/yassl/{cmakelists.txt => CMakeLists.txt} | 0 extra/yassl/taocrypt/{cmakelists.txt => CMakeLists.txt} | 0 libmysql/{cmakelists.txt => CMakeLists.txt} | 0 libmysqld/{cmakelists.txt => CMakeLists.txt} | 0 libmysqld/examples/{cmakelists.txt => CMakeLists.txt} | 0 mysys/{cmakelists.txt => CMakeLists.txt} | 0 regex/{cmakelists.txt => CMakeLists.txt} | 0 server-tools/instance-manager/{cmakelists.txt => CMakeLists.txt} | 0 sql/{cmakelists.txt => CMakeLists.txt} | 0 storage/archive/{cmakelists.txt => CMakeLists.txt} | 0 storage/bdb/{cmakelists.txt => CMakeLists.txt} | 0 storage/blackhole/{cmakelists.txt => CMakeLists.txt} | 0 storage/csv/{cmakelists.txt => CMakeLists.txt} | 0 storage/example/{cmakelists.txt => CMakeLists.txt} | 0 storage/heap/{cmakelists.txt => CMakeLists.txt} | 0 storage/innobase/{cmakelists.txt => CMakeLists.txt} | 0 storage/myisam/{cmakelists.txt => CMakeLists.txt} | 0 storage/myisammrg/{cmakelists.txt => CMakeLists.txt} | 0 strings/{cmakelists.txt => CMakeLists.txt} | 0 tests/{cmakelists.txt => CMakeLists.txt} | 0 vio/{cmakelists.txt => CMakeLists.txt} | 0 zlib/{cmakelists.txt => CMakeLists.txt} | 0 26 files changed, 0 insertions(+), 0 deletions(-) rename cmakelists.txt => CMakeLists.txt (100%) rename client/{cmakelists.txt => CMakeLists.txt} (100%) rename dbug/{cmakelists.txt => CMakeLists.txt} (100%) rename extra/{cmakelists.txt => CMakeLists.txt} (100%) rename extra/yassl/{cmakelists.txt => CMakeLists.txt} (100%) rename extra/yassl/taocrypt/{cmakelists.txt => CMakeLists.txt} (100%) rename libmysql/{cmakelists.txt => CMakeLists.txt} (100%) rename libmysqld/{cmakelists.txt => CMakeLists.txt} (100%) rename libmysqld/examples/{cmakelists.txt => CMakeLists.txt} (100%) rename mysys/{cmakelists.txt => CMakeLists.txt} (100%) rename regex/{cmakelists.txt => CMakeLists.txt} (100%) rename server-tools/instance-manager/{cmakelists.txt => CMakeLists.txt} (100%) rename sql/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/archive/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/bdb/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/blackhole/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/csv/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/example/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/heap/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/innobase/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/myisam/{cmakelists.txt => CMakeLists.txt} (100%) rename storage/myisammrg/{cmakelists.txt => CMakeLists.txt} (100%) rename strings/{cmakelists.txt => CMakeLists.txt} (100%) rename tests/{cmakelists.txt => CMakeLists.txt} (100%) rename vio/{cmakelists.txt => CMakeLists.txt} (100%) rename zlib/{cmakelists.txt => CMakeLists.txt} (100%) diff --git a/cmakelists.txt b/CMakeLists.txt similarity index 100% rename from cmakelists.txt rename to CMakeLists.txt diff --git a/client/cmakelists.txt b/client/CMakeLists.txt similarity index 100% rename from client/cmakelists.txt rename to client/CMakeLists.txt diff --git a/dbug/cmakelists.txt b/dbug/CMakeLists.txt similarity index 100% rename from dbug/cmakelists.txt rename to dbug/CMakeLists.txt diff --git a/extra/cmakelists.txt b/extra/CMakeLists.txt similarity index 100% rename from extra/cmakelists.txt rename to extra/CMakeLists.txt diff --git a/extra/yassl/cmakelists.txt b/extra/yassl/CMakeLists.txt similarity index 100% rename from extra/yassl/cmakelists.txt rename to extra/yassl/CMakeLists.txt diff --git a/extra/yassl/taocrypt/cmakelists.txt b/extra/yassl/taocrypt/CMakeLists.txt similarity index 100% rename from extra/yassl/taocrypt/cmakelists.txt rename to extra/yassl/taocrypt/CMakeLists.txt diff --git a/libmysql/cmakelists.txt b/libmysql/CMakeLists.txt similarity index 100% rename from libmysql/cmakelists.txt rename to libmysql/CMakeLists.txt diff --git a/libmysqld/cmakelists.txt b/libmysqld/CMakeLists.txt similarity index 100% rename from libmysqld/cmakelists.txt rename to libmysqld/CMakeLists.txt diff --git a/libmysqld/examples/cmakelists.txt b/libmysqld/examples/CMakeLists.txt similarity index 100% rename from libmysqld/examples/cmakelists.txt rename to libmysqld/examples/CMakeLists.txt diff --git a/mysys/cmakelists.txt b/mysys/CMakeLists.txt similarity index 100% rename from mysys/cmakelists.txt rename to mysys/CMakeLists.txt diff --git a/regex/cmakelists.txt b/regex/CMakeLists.txt similarity index 100% rename from regex/cmakelists.txt rename to regex/CMakeLists.txt diff --git a/server-tools/instance-manager/cmakelists.txt b/server-tools/instance-manager/CMakeLists.txt similarity index 100% rename from server-tools/instance-manager/cmakelists.txt rename to server-tools/instance-manager/CMakeLists.txt diff --git a/sql/cmakelists.txt b/sql/CMakeLists.txt similarity index 100% rename from sql/cmakelists.txt rename to sql/CMakeLists.txt diff --git a/storage/archive/cmakelists.txt b/storage/archive/CMakeLists.txt similarity index 100% rename from storage/archive/cmakelists.txt rename to storage/archive/CMakeLists.txt diff --git a/storage/bdb/cmakelists.txt b/storage/bdb/CMakeLists.txt similarity index 100% rename from storage/bdb/cmakelists.txt rename to storage/bdb/CMakeLists.txt diff --git a/storage/blackhole/cmakelists.txt b/storage/blackhole/CMakeLists.txt similarity index 100% rename from storage/blackhole/cmakelists.txt rename to storage/blackhole/CMakeLists.txt diff --git a/storage/csv/cmakelists.txt b/storage/csv/CMakeLists.txt similarity index 100% rename from storage/csv/cmakelists.txt rename to storage/csv/CMakeLists.txt diff --git a/storage/example/cmakelists.txt b/storage/example/CMakeLists.txt similarity index 100% rename from storage/example/cmakelists.txt rename to storage/example/CMakeLists.txt diff --git a/storage/heap/cmakelists.txt b/storage/heap/CMakeLists.txt similarity index 100% rename from storage/heap/cmakelists.txt rename to storage/heap/CMakeLists.txt diff --git a/storage/innobase/cmakelists.txt b/storage/innobase/CMakeLists.txt similarity index 100% rename from storage/innobase/cmakelists.txt rename to storage/innobase/CMakeLists.txt diff --git a/storage/myisam/cmakelists.txt b/storage/myisam/CMakeLists.txt similarity index 100% rename from storage/myisam/cmakelists.txt rename to storage/myisam/CMakeLists.txt diff --git a/storage/myisammrg/cmakelists.txt b/storage/myisammrg/CMakeLists.txt similarity index 100% rename from storage/myisammrg/cmakelists.txt rename to storage/myisammrg/CMakeLists.txt diff --git a/strings/cmakelists.txt b/strings/CMakeLists.txt similarity index 100% rename from strings/cmakelists.txt rename to strings/CMakeLists.txt diff --git a/tests/cmakelists.txt b/tests/CMakeLists.txt similarity index 100% rename from tests/cmakelists.txt rename to tests/CMakeLists.txt diff --git a/vio/cmakelists.txt b/vio/CMakeLists.txt similarity index 100% rename from vio/cmakelists.txt rename to vio/CMakeLists.txt diff --git a/zlib/cmakelists.txt b/zlib/CMakeLists.txt similarity index 100% rename from zlib/cmakelists.txt rename to zlib/CMakeLists.txt From e672bdc82475fbb096fa687937c1d75aafe43118 Mon Sep 17 00:00:00 2001 From: "reggie@linux.site" <> Date: Thu, 11 May 2006 14:46:11 -0500 Subject: [PATCH 4/4] removed handlerton-win.cc (again) --- sql/handlerton-win.cc | 72 ------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 sql/handlerton-win.cc diff --git a/sql/handlerton-win.cc b/sql/handlerton-win.cc deleted file mode 100644 index 9ce4eab2444..00000000000 --- a/sql/handlerton-win.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include "mysql_priv.h" - -extern handlerton heap_hton; -extern handlerton myisam_hton; -extern handlerton myisammrg_hton; -extern handlerton binlog_hton; -#ifdef WITH_INNOBASE_STORAGE_ENGINE -extern handlerton innobase_hton; -#endif -#ifdef WITH_BERKELEY_STORAGE_ENGINE -extern handlerton berkeley_hton; -#endif -#ifdef WITH_EXAMPLE_STORAGE_ENGINE -extern handlerton example_hton; -#endif -#ifdef WITH_ARCHIVE_STORAGE_ENGINE -extern handlerton archive_hton; -#endif -#ifdef WITH_CSV_STORAGE_ENGINE -extern handlerton tina_hton; -#endif -#ifdef WITH_BLACKHOLE_STORAGE_ENGINE -extern handlerton blackhole_hton; -#endif -#ifdef WITH_FEDERATED_STORAGE_ENGINE -extern handlerton federated_hton; -#endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE -extern handlerton ndbcluster_hton; -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE -extern handlerton partition_hton; -#endif - -/* - This array is used for processing compiled in engines. -*/ -handlerton *sys_table_types[]= -{ - &heap_hton, - &myisam_hton, -#ifdef WITH_INNOBASE_STORAGE_ENGINE - &innobase_hton, -#endif -#ifdef WITH_BERKELEY_STORAGE_ENGINE - &berkeley_hton, -#endif -#ifdef WITH_EXAMPLE_STORAGE_ENGINE - &example_hton, -#endif -#ifdef WITH_ARCHIVE_STORAGE_ENGINE - &archive_hton, -#endif -#ifdef WITH_CSV_STORAGE_ENGINE - &tina_hton, -#endif -#ifdef WITH_BLACKHOLE_STORAGE_ENGINE - &blackhole_hton, -#endif -#ifdef WITH_FEDERATED_STORAGE_ENGINE - &federated_hton, -#endif -#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE - &ndbcluster_hton, -#endif -#ifdef WITH_PARTITION_STORAGE_ENGINE - &partition_hton, -#endif - &myisammrg_hton, - &binlog_hton, - NULL -};