Skip to content

Commit 0e55cc7

Browse files
author
Hery Ramilison
committed
Merge branch 'mysql-5.7.15-release' into mysql-5.7.16-release
2 parents d4ba8b1 + 71f48ab commit 0e55cc7

File tree

14 files changed

+298
-75
lines changed

14 files changed

+298
-75
lines changed

include/my_sys.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ C_MODE_START
8989
#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
9090
#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
9191
#define MY_REDEL_MAKE_BACKUP 256
92+
#define MY_REDEL_NO_COPY_STAT 512 /* my_redel() doesn't call my_copystat() */
9293
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
9394
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
9495
#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */

include/myisam.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -425,12 +425,13 @@ int chk_size(MI_CHECK *param, MI_INFO *info);
425425
int chk_key(MI_CHECK *param, MI_INFO *info);
426426
int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend);
427427
int mi_repair(MI_CHECK *param, MI_INFO *info,
428-
char * name, int rep_quick);
429-
int mi_sort_index(MI_CHECK *param, MI_INFO *info, char * name);
428+
char * name, int rep_quick, my_bool no_copy_stat);
429+
int mi_sort_index(MI_CHECK *param, MI_INFO *info, char * name,
430+
my_bool no_copy_stat);
430431
int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info,
431-
const char * name, int rep_quick);
432+
const char * name, int rep_quick, my_bool no_copy_stat);
432433
int mi_repair_parallel(MI_CHECK *param, MI_INFO *info,
433-
const char * name, int rep_quick);
434+
const char * name, int rep_quick, my_bool no_copy_stat);
434435
int change_to_newfile(const char * filename, const char * old_ext,
435436
const char * new_ext, myf myflags);
436437
int lock_file(MI_CHECK *param, File file, my_off_t start, int lock_type,

mysys/my_redel.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,9 @@
3333
3434
if MY_REDEL_MAKE_COPY is given, then the orginal file
3535
is renamed to org_name-'current_time'.BAK
36+
37+
if MY_REDEL_NO_COPY_STAT is given, stats are not copied
38+
from org_name to tmp_name.
3639
*/
3740

3841
#define REDEL_EXT ".BAK"
@@ -44,8 +47,11 @@ int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
4447
DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d",
4548
org_name,tmp_name,MyFlags));
4649

47-
if (my_copystat(org_name,tmp_name,MyFlags) < 0)
48-
goto end;
50+
if (!(MyFlags & MY_REDEL_NO_COPY_STAT))
51+
{
52+
if (my_copystat(org_name,tmp_name,MyFlags) < 0)
53+
goto end;
54+
}
4955
if (MyFlags & MY_REDEL_MAKE_BACKUP)
5056
{
5157
char name_buff[FN_REFLEN+20];

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.

0 commit comments

Comments
 (0)