mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Automerge from mysql-trunk-merge.
This commit is contained in:
commit
583d724e64
4 changed files with 164 additions and 1 deletions
|
@ -64,6 +64,7 @@ cflags="@CFLAGS@"
|
|||
|
||||
STRIP=1 # Option ignored
|
||||
SILENT=0
|
||||
MALLOC_LIB=
|
||||
PLATFORM=""
|
||||
TMP=/tmp
|
||||
NEW_NAME="" # Final top directory and TAR package name
|
||||
|
@ -76,6 +77,7 @@ for arg do
|
|||
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
|
||||
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
|
||||
--short-product-tag=*) SHORT_PRODUCT_TAG=`echo "$arg" | sed -e "s;--short-product-tag=;;"` ;;
|
||||
--inject-malloc-lib=*) MALLOC_LIB=`echo "$arg" | sed -e 's;^[^=]*=;;'` ;;
|
||||
--no-strip) STRIP=0 ;;
|
||||
--machine=*) machine=`echo "$arg" | sed -e "s;--machine=;;"` ;;
|
||||
--platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;;
|
||||
|
@ -293,6 +295,12 @@ if [ x"$BASE_SYSTEM" != x"netware" ] ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# If requested, add a malloc library .so into pkglibdir for use
|
||||
# by mysqld_safe
|
||||
if [ -n "$MALLOC_LIB" ]; then
|
||||
cp "$MALLOC_LIB" "$DEST/lib/"
|
||||
fi
|
||||
|
||||
# FIXME let this script be in "bin/", where it is in the RPMs?
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/mysql-install-db-problems.html
|
||||
mkdir $DEST/scripts
|
||||
|
|
|
@ -167,6 +167,10 @@ Options:
|
|||
--port [$port]
|
||||
--version [$version]
|
||||
--libmysqld-libs [$embedded_libs]
|
||||
--variable=VAR VAR is one of:
|
||||
pkgincludedir [$pkgincludedir]
|
||||
pkglibdir [$pkglibdir]
|
||||
plugindir [$plugindir]
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
@ -184,6 +188,15 @@ while test $# -gt 0; do
|
|||
--port) echo "$port" ;;
|
||||
--version) echo "$version" ;;
|
||||
--embedded-libs | --embedded | --libmysqld-libs) echo "$embedded_libs" ;;
|
||||
--variable=*)
|
||||
var=`echo "$1" | sed 's,^[^=]*=,,'`
|
||||
case "$var" in
|
||||
pkgincludedir) echo "$pkgincludedir" ;;
|
||||
pkglibdir) echo "$pkglibdir" ;;
|
||||
plugindir) echo "$plugindir" ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
;;
|
||||
*) usage ;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -11,9 +11,13 @@
|
|||
# mysql.server works by first doing a cd to the base directory and from there
|
||||
# executing mysqld_safe
|
||||
|
||||
# Initialize script globals
|
||||
KILL_MYSQLD=1;
|
||||
MYSQLD=
|
||||
niceness=0
|
||||
mysqld_ld_preload=
|
||||
mysqld_ld_library_path=
|
||||
|
||||
# Initial logging status: error log is not open, and not using syslog
|
||||
logging=init
|
||||
want_syslog=0
|
||||
|
@ -46,6 +50,7 @@ Usage: $0 [OPTIONS]
|
|||
--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
|
||||
--malloc-lib=LIB Preload shared library LIB if available
|
||||
--mysqld=FILE Use the specified file as mysqld
|
||||
--mysqld-version=VERSION Use "mysqld-VERSION" as mysqld
|
||||
--nice=NICE Set the scheduling priority of mysqld
|
||||
|
@ -172,6 +177,7 @@ parse_arguments() {
|
|||
# mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])!
|
||||
--core-file-size=*) core_file_size="$val" ;;
|
||||
--ledir=*) ledir="$val" ;;
|
||||
--malloc-lib=*) set_malloc_lib "$val" ;;
|
||||
--mysqld=*) MYSQLD="$val" ;;
|
||||
--mysqld-version=*)
|
||||
if test -n "$val"
|
||||
|
@ -202,6 +208,131 @@ parse_arguments() {
|
|||
}
|
||||
|
||||
|
||||
# Add a single shared library to the list of libraries which will be added to
|
||||
# LD_PRELOAD for mysqld
|
||||
#
|
||||
# Since LD_PRELOAD is a space-separated value (for historical reasons), if a
|
||||
# shared lib's path contains spaces, that path will be prepended to
|
||||
# LD_LIBRARY_PATH and stripped from the lib value.
|
||||
add_mysqld_ld_preload() {
|
||||
lib_to_add="$1"
|
||||
log_notice "Adding '$lib_to_add' to LD_PRELOAD for mysqld"
|
||||
|
||||
case "$lib_to_add" in
|
||||
*' '*)
|
||||
# Must strip path from lib, and add it to LD_LIBRARY_PATH
|
||||
lib_file=`basename "$lib_to_add"`
|
||||
case "$lib_file" in
|
||||
*' '*)
|
||||
# The lib file itself has a space in its name, and can't
|
||||
# be used in LD_PRELOAD
|
||||
log_error "library name '$lib_to_add' contains spaces and can not be used with LD_PRELOAD"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
lib_path=`dirname "$lib_to_add"`
|
||||
lib_to_add="$lib_file"
|
||||
[ -n "$mysqld_ld_library_path" ] && mysqld_ld_library_path="$mysqld_ld_library_path:"
|
||||
mysqld_ld_library_path="$mysqld_ld_library_path$lib_path"
|
||||
;;
|
||||
esac
|
||||
|
||||
# LD_PRELOAD is a space-separated
|
||||
[ -n "$mysqld_ld_preload" ] && mysqld_ld_preload="$mysqld_ld_preload "
|
||||
mysqld_ld_preload="${mysqld_ld_preload}$lib_to_add"
|
||||
}
|
||||
|
||||
|
||||
# Returns LD_PRELOAD (and LD_LIBRARY_PATH, if needed) text, quoted to be
|
||||
# suitable for use in the eval that calls mysqld.
|
||||
#
|
||||
# All values in mysqld_ld_preload are prepended to LD_PRELOAD.
|
||||
mysqld_ld_preload_text() {
|
||||
text=
|
||||
|
||||
if [ -n "$mysqld_ld_preload" ]; then
|
||||
new_text="$mysqld_ld_preload"
|
||||
[ -n "$LD_PRELOAD" ] && new_text="$new_text $LD_PRELOAD"
|
||||
text="${text}LD_PRELOAD="`shell_quote_string "$new_text"`' '
|
||||
fi
|
||||
|
||||
if [ -n "$mysqld_ld_library_path" ]; then
|
||||
new_text="$mysqld_ld_library_path"
|
||||
[ -n "$LD_LIBRARY_PATH" ] && new_text="$new_text:$LD_LIBRARY_PATH"
|
||||
text="${text}LD_LIBRARY_PATH="`shell_quote_string "$new_text"`' '
|
||||
fi
|
||||
|
||||
echo "$text"
|
||||
}
|
||||
|
||||
|
||||
mysql_config=
|
||||
get_mysql_config() {
|
||||
if [ -z "$mysql_config" ]; then
|
||||
mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
|
||||
if [ ! -x "$mysql_config" ]; then
|
||||
log_error "Can not run mysql_config $@ from '$mysql_config'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
"$mysql_config" "$@"
|
||||
}
|
||||
|
||||
|
||||
# set_malloc_lib LIB
|
||||
# - If LIB is empty, do nothing and return
|
||||
# - If LIB is 'tcmalloc', look for tcmalloc shared library in /usr/lib
|
||||
# then pkglibdir. tcmalloc is part of the Google perftools project.
|
||||
# - If LIB is an absolute path, assume it is a malloc shared library
|
||||
#
|
||||
# Put LIB in mysqld_ld_preload, which will be added to LD_PRELOAD when
|
||||
# running mysqld. See ld.so for details.
|
||||
set_malloc_lib() {
|
||||
malloc_lib="$1"
|
||||
|
||||
if [ "$malloc_lib" = tcmalloc ]; then
|
||||
pkglibdir=`get_mysql_config --variable=pkglibdir`
|
||||
malloc_lib=
|
||||
# This list is kept intentionally simple. Simply set --malloc-lib
|
||||
# to a full path if another location is desired.
|
||||
for libdir in /usr/lib "$pkglibdir"; do
|
||||
for flavor in _minimal '' _and_profiler _debug; do
|
||||
tmp="$libdir/libtcmalloc$flavor.so"
|
||||
#log_notice "DEBUG: Checking for malloc lib '$tmp'"
|
||||
[ -r "$tmp" ] || continue
|
||||
malloc_lib="$tmp"
|
||||
break 2
|
||||
done
|
||||
done
|
||||
|
||||
if [ -z "$malloc_lib" ]; then
|
||||
log_error "no shared library for --malloc-lib=tcmalloc found in /usr/lib or $pkglibdir"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Allow --malloc-lib='' to override other settings
|
||||
[ -z "$malloc_lib" ] && return
|
||||
|
||||
case "$malloc_lib" in
|
||||
/*)
|
||||
if [ ! -r "$malloc_lib" ]; then
|
||||
log_error "--malloc-lib '$malloc_lib' can not be read and will not be used"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_error "--malloc-lib must be an absolute path or 'tcmalloc'; " \
|
||||
"ignoring value '$malloc_lib'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
add_mysqld_ld_preload "$malloc_lib"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# First, try to find BASEDIR and ledir (where mysqld is)
|
||||
#
|
||||
|
@ -549,7 +680,7 @@ fi
|
|||
# ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems
|
||||
#fi
|
||||
|
||||
cmd="$NOHUP_NICENESS"
|
||||
cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"
|
||||
|
||||
for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
|
||||
"--datadir=$DATADIR" "$USER_OPTION"
|
||||
|
|
|
@ -448,6 +448,13 @@ $MBD/libtool --mode=execute install -m 755 \
|
|||
$RPM_BUILD_DIR/mysql-%{mysql_version}/mysql-debug-%{mysql_version}/sql/mysqld \
|
||||
$RBR%{_sbindir}/mysqld-debug
|
||||
|
||||
%if %{?malloc_lib_target:1}%{!?malloc_lib_target:0}
|
||||
# Even though this is a shared library, put it under /usr/lib/mysql, so it
|
||||
# doesn't conflict with possible shared lib by the same name in /usr/lib. See
|
||||
# `mysql_config --variable=pkglibdir` and mysqld_safe for how this is used.
|
||||
install -m 644 "%{malloc_lib_source}" "$RBR%{_libdir}/mysql/%{malloc_lib_target}"
|
||||
%endif
|
||||
|
||||
# install saved perror binary with NDB support (BUG#13740)
|
||||
install -m 755 $MBD/extra/perror $RBR%{_bindir}/perror
|
||||
|
||||
|
@ -707,6 +714,10 @@ fi
|
|||
%attr(755, root, root) %{_libdir}/mysql/plugin/ha_innodb_plugin.so*
|
||||
%endif
|
||||
|
||||
%if %{?malloc_lib_target:1}%{!?malloc_lib_target:0}
|
||||
%attr(755, root, root) %{_libdir}/mysql/%{malloc_lib_target}
|
||||
%endif
|
||||
|
||||
%attr(755, root, root) %{_sbindir}/mysqld
|
||||
%attr(755, root, root) %{_sbindir}/mysqld-debug
|
||||
%attr(755, root, root) %{_sbindir}/rcmysql
|
||||
|
|
Loading…
Reference in a new issue