Skip to content

Commit f75735e

Browse files
trostenHery Ramilison
authored andcommitted
Merge branch 'mysql-5.6' into mysql-5.7
(cherry picked from commit e014f447d5a9c946461029d2c479befdc42c354a)
1 parent ffc109d commit f75735e

File tree

4 files changed

+73
-42
lines changed

4 files changed

+73
-42
lines changed

packaging/rpm-oel/mysql.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ start(){
131131
# alarms, per bug #547485
132132
$exec --datadir="$datadir" --socket="$socketfile" \
133133
--pid-file="$mypidfile" \
134-
--basedir=/usr --user=mysql $extra_opts >/dev/null 2>&1 &
134+
--basedir=/usr --user=mysql $extra_opts >/dev/null &
135135
safe_pid=$!
136136
# Spin for a maximum of N seconds waiting for the server to come up;
137137
# exit the loop immediately if mysqld_safe process disappears.

packaging/rpm-sles/mysql.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ start () {
178178
rc_failed 6 ; rc_status -v ; rc_exit
179179
fi
180180

181-
$PROG --basedir=/usr --datadir="$datadir" --pid-file="$pidfile" $extra_opts >/dev/null 2>&1 &
181+
$PROG --basedir=/usr --datadir="$datadir" --pid-file="$pidfile" $extra_opts >/dev/null &
182182
if pinger $! ; then
183183
echo -n "Starting service MySQL:"
184184
touch $lockfile

scripts/mysqld_safe.sh

Lines changed: 70 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,17 @@ parse_arguments() {
212212
--core-file-size=*) core_file_size="$val" ;;
213213
--ledir=*) ledir="$val" ;;
214214
--malloc-lib=*) set_malloc_lib "$val" ;;
215-
--mysqld=*) MYSQLD="$val" ;;
215+
--mysqld=*)
216+
if [ -z "$pick_args" ]; then
217+
log_error "--mysqld option can only be used as command line option, found in config file"
218+
exit 1
219+
fi
220+
MYSQLD="$val" ;;
216221
--mysqld-version=*)
222+
if [ -z "$pick_args" ]; then
223+
log_error "--mysqld-version option can only be used as command line option, found in config file"
224+
exit 1
225+
fi
217226
if test -n "$val"
218227
then
219228
MYSQLD="mysqld-$val"
@@ -302,38 +311,22 @@ mysqld_ld_preload_text() {
302311
echo "$text"
303312
}
304313

305-
306-
mysql_config=
307-
get_mysql_config() {
308-
if [ -z "$mysql_config" ]; then
309-
mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
310-
if [ ! -x "$mysql_config" ]; then
311-
log_error "Can not run mysql_config $@ from '$mysql_config'"
312-
exit 1
313-
fi
314-
fi
315-
316-
"$mysql_config" "$@"
317-
}
318-
319-
320314
# set_malloc_lib LIB
321315
# - If LIB is empty, do nothing and return
322-
# - If LIB is 'tcmalloc', look for tcmalloc shared library in /usr/lib
323-
# then pkglibdir. tcmalloc is part of the Google perftools project.
316+
# - If LIB is 'tcmalloc', look for tcmalloc shared library in $malloc_dirs.
317+
# tcmalloc is part of the Google perftools project.
324318
# - If LIB is an absolute path, assume it is a malloc shared library
325319
#
326320
# Put LIB in mysqld_ld_preload, which will be added to LD_PRELOAD when
327321
# running mysqld. See ld.so for details.
328322
set_malloc_lib() {
323+
# This list is kept intentionally simple.
324+
malloc_dirs="/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu"
329325
malloc_lib="$1"
330326

331327
if [ "$malloc_lib" = tcmalloc ]; then
332-
pkglibdir=`get_mysql_config --variable=pkglibdir`
333328
malloc_lib=
334-
# This list is kept intentionally simple. Simply set --malloc-lib
335-
# to a full path if another location is desired.
336-
for libdir in /usr/lib "$pkglibdir" "$pkglibdir/mysql"; do
329+
for libdir in $(echo $malloc_dirs); do
337330
for flavor in _minimal '' _and_profiler _debug; do
338331
tmp="$libdir/libtcmalloc$flavor.so"
339332
#log_notice "DEBUG: Checking for malloc lib '$tmp'"
@@ -344,7 +337,7 @@ set_malloc_lib() {
344337
done
345338

346339
if [ -z "$malloc_lib" ]; then
347-
log_error "no shared library for --malloc-lib=tcmalloc found in /usr/lib or $pkglibdir"
340+
log_error "no shared library for --malloc-lib=tcmalloc found in $malloc_dirs"
348341
exit 1
349342
fi
350343
fi
@@ -355,9 +348,21 @@ set_malloc_lib() {
355348
case "$malloc_lib" in
356349
/*)
357350
if [ ! -r "$malloc_lib" ]; then
358-
log_error "--malloc-lib '$malloc_lib' can not be read and will not be used"
351+
log_error "--malloc-lib can not be read and will not be used"
359352
exit 1
360353
fi
354+
355+
# Restrict to a the list in $malloc_dirs above
356+
case "$(dirname "$malloc_lib")" in
357+
/usr/lib) ;;
358+
/usr/lib64) ;;
359+
/usr/lib/i386-linux-gnu) ;;
360+
/usr/lib/x86_64-linux-gnu) ;;
361+
*)
362+
log_error "--malloc-lib must be located in one of the directories: $malloc_dirs"
363+
exit 1
364+
;;
365+
esac
361366
;;
362367
*)
363368
log_error "--malloc-lib must be an absolute path or 'tcmalloc'; " \
@@ -529,7 +534,9 @@ then
529534
exit 1
530535
fi
531536
fi
532-
rm -f "$safe_pid"
537+
if [ ! -h "$safe_pid" ]; then
538+
rm -f "$safe_pid"
539+
fi
533540
if test -f "$safe_pid"
534541
then
535542
log_error "Fatal error: Can't remove the mysqld_safe pid file"
@@ -550,7 +557,9 @@ then
550557
if [ $? -ne 0 ]
551558
then
552559
log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe."
553-
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
560+
if [ ! -h "$safe_pid" ]; then
561+
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
562+
fi
554563
exit 1
555564
fi
556565
fi
@@ -620,7 +629,7 @@ then
620629
USER_OPTION="--user=$user"
621630
fi
622631
# Change the err log to the right user, if it is in use
623-
if [ $want_syslog -eq 0 ]; then
632+
if [ $want_syslog -eq 0 -a ! -h "$err_log" ]; then
624633
touch "$err_log"
625634
chown $user "$err_log"
626635
fi
@@ -640,9 +649,11 @@ safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
640649
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
641650
if [ ! -d $mysql_unix_port_dir ]
642651
then
643-
mkdir $mysql_unix_port_dir
644-
chown $user $mysql_unix_port_dir
645-
chmod 755 $mysql_unix_port_dir
652+
if [ ! -h $mysql_unix_port_dir ]; then
653+
mkdir $mysql_unix_port_dir
654+
chown $user $mysql_unix_port_dir
655+
chmod 755 $mysql_unix_port_dir
656+
fi
646657
fi
647658

648659
# If the user doesn't specify a binary, we assume name "mysqld"
@@ -658,7 +669,9 @@ does not exist or is not executable. Please cd to the mysql installation
658669
directory and restart this script from there as follows:
659670
./bin/mysqld_safe&
660671
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information"
661-
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
672+
if [ ! -h "$safe_pid" ]; then
673+
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
674+
fi
662675
exit 1
663676
fi
664677

@@ -752,18 +765,24 @@ then
752765
if @FIND_PROC@
753766
then # The pid contains a mysqld process
754767
log_error "A mysqld process already exists"
755-
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
768+
if [ ! -h "$safe_pid" ]; then
769+
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
770+
fi
756771
exit 1
757772
fi
758773
fi
759-
rm -f "$pid_file"
774+
if [ ! -h "$pid_file" ]; then
775+
rm -f "$pid_file"
776+
fi
760777
if test -f "$pid_file"
761778
then
762779
log_error "Fatal error: Can't remove the pid file:
763780
$pid_file
764781
Please remove it manually and start $0 again;
765782
mysqld daemon not started"
766-
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
783+
if [ ! -h "$safe_pid" ]; then
784+
rm -f "$safe_pid" # Clean Up of mysqld_safe.pid file.
785+
fi
767786
exit 1
768787
fi
769788
fi
@@ -809,12 +828,21 @@ have_sleep=1
809828
while true
810829
do
811830
# Some extra safety
812-
rm -f $safe_mysql_unix_port "$pid_file" "$pid_file.shutdown"
831+
if [ ! -h "$safe_mysql_unix_port" ]; then
832+
rm -f "$safe_mysql_unix_port"
833+
fi
834+
if [ ! -h "$pid_file" ]; then
835+
rm -f "$pid_file"
836+
fi
837+
if [ ! -h "$pid_file.shutdown" ]; then
838+
rm -f "$pid_file.shutdown"
839+
fi
840+
813841
start_time=`date +%M%S`
814842

815843
eval_log_error "$cmd"
816844

817-
if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then
845+
if [ $want_syslog -eq 0 -a ! -f "$err_log" -a ! -h "$err_log" ]; then
818846
touch "$err_log" # hypothetical: log was renamed but not
819847
chown $user "$err_log" # flushed yet. we'd recreate it with
820848
chmod "$fmode" "$err_log" # wrong owner next time we log, so set
@@ -891,9 +919,12 @@ do
891919
log_notice "mysqld restarted"
892920
done
893921

894-
rm -f "$pid_file.shutdown"
922+
if [ ! -h "$pid_file.shutdown" ]; then
923+
rm -f "$pid_file.shutdown"
924+
fi
895925

896926
log_notice "mysqld from pid file $pid_file ended"
897927

898-
rm -f "$safe_pid" # Some Extra Safety. File is deleted
899-
# once the mysqld process ends.
928+
if [ ! -h "$safe_pid" ]; then
929+
rm -f "$safe_pid" # Some Extra Safety. File is deleted
930+
fi # once the mysqld process ends.

support-files/mysql.server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ case "$mode" in
280280
then
281281
# Give extra arguments to mysqld with the my.cnf file. This script
282282
# may be overwritten at next upgrade.
283-
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
283+
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &
284284
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
285285

286286
# Make lock for RedHat / SuSE

0 commit comments

Comments
 (0)