Commit c1df101f authored by unknown's avatar unknown

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  mysql.com:/home/ram/work/b29980/b29980.5.1

parents f00620ba b4a10153
...@@ -14,12 +14,17 @@ ...@@ -14,12 +14,17 @@
KILL_MYSQLD=1; KILL_MYSQLD=1;
MYSQLD= MYSQLD=
niceness=0 niceness=0
# Default on, unless --log-error is specified (and before options are parsed) # Initial logging status: error log is not open, and not using syslog
syslog=2 logging=init
want_syslog=0
syslog_tag=
user=@MYSQLD_USER@ user=@MYSQLD_USER@
pid_file= pid_file=
err_log= err_log=
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
trap '' 1 2 3 15 # we shouldn't let anyone kill us trap '' 1 2 3 15 # we shouldn't let anyone kill us
umask 007 umask 007
...@@ -46,7 +51,8 @@ Usage: $0 [OPTIONS] ...@@ -46,7 +51,8 @@ Usage: $0 [OPTIONS]
--nice=NICE Set the scheduling priority of mysqld --nice=NICE Set the scheduling priority of mysqld
--skip-kill-mysqld Don't try to kill stray mysqld processes --skip-kill-mysqld Don't try to kill stray mysqld processes
--syslog Log messages to syslog with 'logger' --syslog Log messages to syslog with 'logger'
--skip-syslog Log messages to error log --skip-syslog Log messages to error log (default)
--syslog-tag=TAG Pass -t "mysqld-TAG" to 'logger'
All other options are passed to the mysqld program. All other options are passed to the mysqld program.
...@@ -54,18 +60,46 @@ EOF ...@@ -54,18 +60,46 @@ EOF
exit 1 exit 1
} }
my_which ()
{
save_ifs="${IFS-UNSET}"
IFS=:
for file
do
for dir in $PATH
do
if [ -f "$dir/$file" ]
then
echo "$dir/$file"
continue 2
fi
done
return 1 # Failure, didn't find file in path
done
if [ "$save_ifs" = UNSET ]
then
unset IFS
else
IFS="$save_ifs"
fi
return 0 # Success
}
log_generic () { log_generic () {
priority="$1" priority="$1"
shift shift
msg="`date +'%y%m%d %H:%M:%S'` mysqld_safe $*" msg="`date +'%y%m%d %H:%M:%S'` mysqld_safe $*"
echo "$msg" echo "$msg"
if [ $syslog -eq 0 ] case $logging in
then init) ;; # Just echo the message, don't save it anywhere
echo "$msg" >> "$err_log" file) echo "$msg" >> "$err_log" ;;
else syslog) logger -t "$syslog_tag_mysqld_safe" -p "$priority" "$*" ;;
logger -i -t mysqld_safe -p "$priority" "$*" *)
fi echo "Internal program error (non-fatal):" \
" unknown logging method '$logging'" >&2
;;
esac
} }
log_error () { log_error () {
...@@ -78,15 +112,23 @@ log_notice () { ...@@ -78,15 +112,23 @@ log_notice () {
eval_log_error () { eval_log_error () {
cmd="$1" cmd="$1"
if [ $syslog -eq 0 ] case $logging in
then file) cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" ;;
cmd="$cmd >> "`shell_quote_string "$err_log"`" 2>&1" syslog)
else # mysqld often prefixes its messages with a timestamp, which is
# mysqld often (not always) prefixes messages on stdout with a # redundant when logging to syslog (which adds its own timestamp)
# timestamp in the form of '%y%m%d %H:%M:%S '; this is redundant # However, we don't strip the timestamp with sed here, because
# when logging via syslog, so strip it # sed buffers output (only GNU sed supports a -u (unbuffered) option)
cmd="$cmd 2>&1 | sed -e 's/^[0-9]\{6\} [0-9:]\{8\} *//' | logger -i -t mysqld -p daemon.error" # which means that messages may not get sent to syslog until the
fi # mysqld process quits.
cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error"
;;
*)
echo "Internal program error (non-fatal):" \
" unknown logging method '$logging'" >&2
;;
esac
#echo "Running mysqld: [$cmd]" #echo "Running mysqld: [$cmd]"
eval "$cmd" eval "$cmd"
} }
...@@ -138,8 +180,9 @@ parse_arguments() { ...@@ -138,8 +180,9 @@ parse_arguments() {
--nice=*) niceness="$val" ;; --nice=*) niceness="$val" ;;
--open-files-limit=*) open_files="$val" ;; --open-files-limit=*) open_files="$val" ;;
--skip-kill-mysqld*) KILL_MYSQLD=0 ;; --skip-kill-mysqld*) KILL_MYSQLD=0 ;;
--syslog) syslog=1 ;; --syslog) want_syslog=1 ;;
--skip-syslog) syslog=0 ;; --skip-syslog) want_syslog=0 ;;
--syslog-tag=*) syslog_tag="$val" ;;
--timezone=*) TZ="$val"; export TZ; ;; --timezone=*) TZ="$val"; export TZ; ;;
--help) usage ;; --help) usage ;;
...@@ -252,7 +295,19 @@ parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysq ...@@ -252,7 +295,19 @@ parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysq
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Determine what logging facility to use # Determine what logging facility to use
if [ -n "$err_log" -o $syslog -eq 0 ]
# Ensure that 'logger' exists, if it's requested
if [ $want_syslog -eq 1 ]
then
my_which logger > /dev/null 2>&1
if [ $? -ne 0 ]
then
log_error "--syslog requested, but no 'logger' program found."
want_syslog=0
fi
fi
if [ -n "$err_log" -o $want_syslog -eq 0 ]
then then
if [ -n "$err_log" ] if [ -n "$err_log" ]
then then
...@@ -279,14 +334,25 @@ then ...@@ -279,14 +334,25 @@ then
append_arg_to_args "--log-error=$err_log" append_arg_to_args "--log-error=$err_log"
if [ $syslog -eq 1 ] if [ $want_syslog -eq 1 ]
then then
# User explicitly asked for syslog, so warn that it isn't used # User explicitly asked for syslog, so warn that it isn't used
log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. Logging to '$err_log'." log_error "Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect."
fi fi
# Don't use syslog since syslog and error log don't mix well # Log to err_log file
syslog=0 log_notice "Logging to '$err_log'."
logging=file
else
if [ -n "$syslog_tag" ]
then
# Sanitize the syslog tag
syslog_tag=`echo "$syslog_tag" | sed -e 's/[^a-zA-Z0-9_-]/_/g'`
syslog_tag_mysqld_safe="${syslog_tag_mysqld_safe}-$syslog_tag"
syslog_tag_mysqld="${syslog_tag_mysqld}-$syslog_tag"
fi
log_notice "Logging to syslog."
logging=syslog
fi fi
USER_OPTION="" USER_OPTION=""
......
...@@ -143,6 +143,10 @@ ADD_CUSTOM_COMMAND( ...@@ -143,6 +143,10 @@ ADD_CUSTOM_COMMAND(
) )
ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash) ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash)
# Remove the auto-generated files as part of 'Clean Solution'
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"lex_hash.h;message.rc;message.h;sql_yacc.h;sql_yacc.cc")
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def) ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
ADD_DEPENDENCIES(udf_example strings) ADD_DEPENDENCIES(udf_example strings)
TARGET_LINK_LIBRARIES(udf_example wsock32) TARGET_LINK_LIBRARIES(udf_example wsock32)
...@@ -6320,7 +6320,8 @@ The minimum value for this variable is 4096.", ...@@ -6320,7 +6320,8 @@ The minimum value for this variable is 4096.",
(uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME], (uchar**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tmp_table_size", OPT_TMP_TABLE_SIZE, {"tmp_table_size", OPT_TMP_TABLE_SIZE,
"If an in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM table.", "If an internal in-memory temporary table exceeds this size, MySQL will"
" automatically convert it to an on-disk MyISAM table.",
(uchar**) &global_system_variables.tmp_table_size, (uchar**) &global_system_variables.tmp_table_size,
(uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL, (uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment