Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7679f5f6
Commit
7679f5f6
authored
Sep 26, 2016
by
Nawaz Nazeer Ahamed
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mysql-5.5.52-release' into mysql-5.5.53-release
parents
0c6eac64
754e7eff
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
258 additions
and
78 deletions
+258
-78
include/my_sys.h
include/my_sys.h
+2
-1
include/myisam.h
include/myisam.h
+6
-5
mysys/my_redel.c
mysys/my_redel.c
+9
-3
packaging/rpm-oel/mysql.init
packaging/rpm-oel/mysql.init
+1
-1
packaging/rpm-sles/mysql.init
packaging/rpm-sles/mysql.init
+1
-1
scripts/mysqld_safe.sh
scripts/mysqld_safe.sh
+47
-32
sql/log.cc
sql/log.cc
+87
-2
sql/log.h
sql/log.h
+10
-0
sql/mysqld.cc
sql/mysqld.cc
+17
-1
sql/sys_vars.cc
sql/sys_vars.cc
+17
-8
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.cc
+21
-5
storage/myisam/mi_check.c
storage/myisam/mi_check.c
+29
-12
storage/myisam/myisamchk.c
storage/myisam/myisamchk.c
+10
-6
support-files/mysql.server.sh
support-files/mysql.server.sh
+1
-1
No files found.
include/my_sys.h
View file @
7679f5f6
/* Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -83,6 +83,7 @@ typedef struct my_aio_result {
#define MY_RESOLVE_LINK 128
/* my_realpath(); Only resolve links */
#define MY_HOLD_ORIGINAL_MODES 128
/* my_copy() holds to file modes */
#define MY_REDEL_MAKE_BACKUP 256
#define MY_REDEL_NO_COPY_STAT 512
/* my_redel() doesn't call my_copystat() */
#define MY_SEEK_NOT_DONE 32
/* my_lock may have to do a seek */
#define MY_DONT_WAIT 64
/* my_lock() don't wait if can't lock */
#define MY_ZEROFILL 32
/* my_malloc(), fill array with zero */
...
...
include/myisam.h
View file @
7679f5f6
/*
Copyright (c) 2000, 201
3
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -426,12 +426,13 @@ int chk_size(MI_CHECK *param, MI_INFO *info);
int
chk_key
(
MI_CHECK
*
param
,
MI_INFO
*
info
);
int
chk_data_link
(
MI_CHECK
*
param
,
MI_INFO
*
info
,
int
extend
);
int
mi_repair
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
,
int
rep_quick
);
int
mi_sort_index
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
);
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
);
int
mi_sort_index
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
,
my_bool
no_copy_stat
);
int
mi_repair_by_sort
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
);
const
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
);
int
mi_repair_parallel
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
);
const
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
);
int
change_to_newfile
(
const
char
*
filename
,
const
char
*
old_ext
,
const
char
*
new_ext
,
myf
myflags
);
int
lock_file
(
MI_CHECK
*
param
,
File
file
,
my_off_t
start
,
int
lock_type
,
...
...
mysys/my_redel.c
View file @
7679f5f6
/* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -35,6 +35,9 @@ struct utimbuf {
if MY_REDEL_MAKE_COPY is given, then the orginal file
is renamed to org_name-'current_time'.BAK
if MY_REDEL_NO_COPY_STAT is given, stats are not copied
from org_name to tmp_name.
*/
#define REDEL_EXT ".BAK"
...
...
@@ -46,8 +49,11 @@ int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
DBUG_PRINT
(
"my"
,(
"org_name: '%s' tmp_name: '%s' MyFlags: %d"
,
org_name
,
tmp_name
,
MyFlags
));
if
(
my_copystat
(
org_name
,
tmp_name
,
MyFlags
)
<
0
)
goto
end
;
if
(
!
(
MyFlags
&
MY_REDEL_NO_COPY_STAT
))
{
if
(
my_copystat
(
org_name
,
tmp_name
,
MyFlags
)
<
0
)
goto
end
;
}
if
(
MyFlags
&
MY_REDEL_MAKE_BACKUP
)
{
char
name_buff
[
FN_REFLEN
+
20
];
...
...
packaging/rpm-oel/mysql.init
View file @
7679f5f6
...
...
@@ -102,7 +102,7 @@ start(){
# alarms, per bug #547485
$exec
--datadir
=
"
$datadir
"
--socket
=
"
$socketfile
"
\
--pid-file
=
"
$mypidfile
"
\
--basedir
=
/usr
--user
=
mysql
>
/dev/null
2>&1
&
--basedir
=
/usr
--user
=
mysql
>
/dev/null &
safe_pid
=
$!
# Spin for a maximum of N seconds waiting for the server to come up;
# exit the loop immediately if mysqld_safe process disappears.
...
...
packaging/rpm-sles/mysql.init
View file @
7679f5f6
...
...
@@ -137,7 +137,7 @@ start () {
rc_failed 6
;
rc_status
-v
;
rc_exit
fi
$PROG
--basedir
=
/usr
--datadir
=
"
$datadir
"
--pid-file
=
"
$pidfile
"
>
/dev/null
2>&1
&
$PROG
--basedir
=
/usr
--datadir
=
"
$datadir
"
--pid-file
=
"
$pidfile
"
>
/dev/null &
if
pinger
$!
;
then
echo
-n
"Starting service MySQL:"
touch
$lockfile
...
...
scripts/mysqld_safe.sh
View file @
7679f5f6
...
...
@@ -208,8 +208,17 @@ parse_arguments() {
--core-file-size
=
*
)
core_file_size
=
"
$val
"
;;
--ledir
=
*
)
ledir
=
"
$val
"
;;
--malloc-lib
=
*
)
set_malloc_lib
"
$val
"
;;
--mysqld
=
*
)
MYSQLD
=
"
$val
"
;;
--mysqld
=
*
)
if
[
-z
"
$pick_args
"
]
;
then
log_error
"--mysqld option can only be used as command line option, found in config file"
exit
1
fi
MYSQLD
=
"
$val
"
;;
--mysqld-version
=
*
)
if
[
-z
"
$pick_args
"
]
;
then
log_error
"--mysqld-version option can only be used as command line option, found in config file"
exit
1
fi
if
test
-n
"
$val
"
then
MYSQLD
=
"mysqld-
$val
"
...
...
@@ -297,38 +306,22 @@ mysqld_ld_preload_text() {
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
# t
hen pkglibdir. t
cmalloc is part of the Google perftools project.
# - If LIB is 'tcmalloc', look for tcmalloc shared library in
$malloc_dirs.
# 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
()
{
# This list is kept intentionally simple.
malloc_dirs
=
"/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu"
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
"
"
$pkglibdir
/mysql"
;
do
for
libdir
in
`
echo
$malloc_dirs
`
;
do
for
flavor
in
_minimal
''
_and_profiler _debug
;
do
tmp
=
"
$libdir
/libtcmalloc
$flavor
.so"
#log_notice "DEBUG: Checking for malloc lib '$tmp'"
...
...
@@ -339,7 +332,7 @@ set_malloc_lib() {
done
if
[
-z
"
$malloc_lib
"
]
;
then
log_error
"no shared library for --malloc-lib=tcmalloc found in
/usr/lib or
$pkglibdir
"
log_error
"no shared library for --malloc-lib=tcmalloc found in
$malloc_dirs
"
exit
1
fi
fi
...
...
@@ -350,9 +343,21 @@ set_malloc_lib() {
case
"
$malloc_lib
"
in
/
*
)
if
[
!
-r
"
$malloc_lib
"
]
;
then
log_error
"--malloc-lib
'
$malloc_lib
'
can not be read and will not be used"
log_error
"--malloc-lib can not be read and will not be used"
exit
1
fi
# Restrict to a the list in $malloc_dirs above
case
"
`
dirname
"
$malloc_lib
"
`
"
in
/usr/lib
)
;;
/usr/lib64
)
;;
/usr/lib/i386-linux-gnu
)
;;
/usr/lib/x86_64-linux-gnu
)
;;
*
)
log_error
"--malloc-lib must be located in one of the directories:
$malloc_dirs
"
exit
1
;;
esac
;;
*
)
log_error
"--malloc-lib must be an absolute path or 'tcmalloc'; "
\
...
...
@@ -569,7 +574,7 @@ then
log_notice
"Logging to '
$err_log
'."
logging
=
file
if
[
!
-f
"
$err_log
"
]
;
then
# if error log already exists,
if
[
!
-f
"
$err_log
"
-a
!
-h
"
$err_log
"
]
;
then
# if error log already exists,
touch
"
$err_log
"
# we just append. otherwise,
chmod
"
$fmode
"
"
$err_log
"
# fix the permissions here!
fi
...
...
@@ -594,7 +599,7 @@ then
USER_OPTION
=
"--user=
$user
"
fi
# Change the err log to the right user, if it is in use
if
[
$want_syslog
-eq
0
]
;
then
if
[
$want_syslog
-eq
0
-a
!
-h
"
$err_log
"
]
;
then
touch
"
$err_log
"
chown
$user
"
$err_log
"
fi
...
...
@@ -614,9 +619,11 @@ safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
mysql_unix_port_dir
=
`
dirname
$safe_mysql_unix_port
`
if
[
!
-d
$mysql_unix_port_dir
]
then
mkdir
$mysql_unix_port_dir
chown
$user
$mysql_unix_port_dir
chmod
755
$mysql_unix_port_dir
if
[
!
-h
$mysql_unix_port_dir
]
;
then
mkdir
$mysql_unix_port_dir
chown
$user
$mysql_unix_port_dir
chmod
755
$mysql_unix_port_dir
fi
fi
# If the user doesn't specify a binary, we assume name "mysqld"
...
...
@@ -728,7 +735,9 @@ then
exit
1
fi
fi
rm
-f
"
$pid_file
"
if
[
!
-h
"
$pid_file
"
]
;
then
rm
-f
"
$pid_file
"
fi
if
test
-f
"
$pid_file
"
then
log_error
"Fatal error: Can't remove the pid file:
...
...
@@ -779,13 +788,19 @@ have_sleep=1
while
true
do
rm
-f
$safe_mysql_unix_port
"
$pid_file
"
# Some extra safety
# Some extra safety
if
[
!
-h
"
$safe_mysql_unix_port
"
]
;
then
rm
-f
"
$safe_mysql_unix_port
"
fi
if
[
!
-h
"
$pid_file
"
]
;
then
rm
-f
"
$pid_file
"
fi
start_time
=
`
date
+%M%S
`
eval_log_error
"
$cmd
"
if
[
$want_syslog
-eq
0
-a
!
-f
"
$err_log
"
]
;
then
if
[
$want_syslog
-eq
0
-a
!
-f
"
$err_log
"
-a
!
-h
"
$err_log
"
]
;
then
touch
"
$err_log
"
# hypothetical: log was renamed but not
chown
$user
"
$err_log
"
# flushed yet. we'd recreate it with
chmod
"
$fmode
"
"
$err_log
"
# wrong owner next time we log, so set
...
...
sql/log.cc
View file @
7679f5f6
...
...
@@ -2293,6 +2293,77 @@ bool MYSQL_LOG::init_and_set_log_file_name(const char *log_name,
}
bool
is_valid_log_name
(
const
char
*
name
,
size_t
len
)
{
if
(
len
>
3
)
{
const
char
*
tail
=
name
+
len
-
4
;
if
(
my_strcasecmp
(
system_charset_info
,
tail
,
".ini"
)
==
0
||
my_strcasecmp
(
system_charset_info
,
tail
,
".cnf"
)
==
0
)
{
return
false
;
}
}
return
true
;
}
/**
Get the real log file name, and possibly reopen file.
Use realpath() to get the path with symbolic links
expanded. Then, close the file, and reopen the real path using the
O_NOFOLLOW flag. This will reject following symbolic links.
@param file File descriptor.
@param log_file_key Key for P_S instrumentation.
@param open_flags Flags to use for opening the file.
@param opened_file_name Name of the open fd.
@retval file descriptor to open file with 'real_file_name', or '-1'
in case of errors.
*/
#ifndef _WIN32
static
File
mysql_file_real_name_reopen
(
File
file
,
#ifdef HAVE_PSI_INTERFACE
PSI_file_key
log_file_key
,
#endif
int
open_flags
,
const
char
*
opened_file_name
)
{
DBUG_ASSERT
(
file
);
DBUG_ASSERT
(
opened_file_name
);
/* Buffer for realpath must have capacity for PATH_MAX. */
char
real_file_name
[
PATH_MAX
];
/* Get realpath, validate, open realpath with O_NOFOLLOW. */
if
(
realpath
(
opened_file_name
,
real_file_name
)
==
NULL
)
{
(
void
)
mysql_file_close
(
file
,
MYF
(
0
));
return
-
1
;
}
if
(
mysql_file_close
(
file
,
MYF
(
0
)))
return
-
1
;
if
(
strlen
(
real_file_name
)
>
FN_REFLEN
)
return
-
1
;
if
(
!
is_valid_log_name
(
real_file_name
,
strlen
(
real_file_name
)))
{
sql_print_error
(
"Invalid log file name after expanding symlinks: '%s'"
,
real_file_name
);
return
-
1
;
}
return
mysql_file_open
(
log_file_key
,
real_file_name
,
open_flags
|
O_NOFOLLOW
,
MYF
(
MY_WME
|
ME_WAITTANG
));
}
#endif // _WIN32
/*
Open a (new) log file.
...
...
@@ -2358,8 +2429,22 @@ bool MYSQL_LOG::open(
if
((
file
=
mysql_file_open
(
log_file_key
,
log_file_name
,
open_flags
,
MYF
(
MY_WME
|
ME_WAITTANG
)))
<
0
||
init_io_cache
(
&
log_file
,
file
,
IO_SIZE
,
io_cache_type
,
MYF
(
MY_WME
|
ME_WAITTANG
)))
<
0
)
goto
err
;
#ifndef _WIN32
/* Reopen and validate path. */
if
((
log_type_arg
==
LOG_UNKNOWN
||
log_type_arg
==
LOG_NORMAL
)
&&
(
file
=
mysql_file_real_name_reopen
(
file
,
#ifdef HAVE_PSI_INTERFACE
log_file_key
,
#endif
open_flags
,
log_file_name
))
<
0
)
goto
err
;
#endif // _WIN32
if
(
init_io_cache
(
&
log_file
,
file
,
IO_SIZE
,
io_cache_type
,
mysql_file_tell
(
file
,
MYF
(
MY_WME
)),
0
,
MYF
(
MY_WME
|
MY_NABP
|
((
log_type
==
LOG_BIN
)
?
MY_WAIT_IF_FULL
:
0
))))
...
...
sql/log.h
View file @
7679f5f6
...
...
@@ -717,6 +717,16 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
char
*
make_log_name
(
char
*
buff
,
const
char
*
name
,
const
char
*
log_ext
);
/**
Check given log name against certain blacklisted names/extensions.
@param name Log name to check
@param len Length of log name
@returns true if name is valid, false otherwise.
*/
bool
is_valid_log_name
(
const
char
*
name
,
size_t
len
);
extern
MYSQL_PLUGIN_IMPORT
MYSQL_BIN_LOG
mysql_bin_log
;
extern
LOGGER
logger
;
...
...
sql/mysqld.cc
View file @
7679f5f6
/* Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights
/* Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify
...
...
@@ -3512,6 +3512,22 @@ static int init_common_variables()
"--log-slow-queries option, log tables are used. "
"To enable logging to files use the --log-output=file option."
);
if
(
opt_logname
&&
!
is_valid_log_name
(
opt_logname
,
strlen
(
opt_logname
)))
{
sql_print_error
(
"Invalid value for --general_log_file: %s"
,
opt_logname
);
return
1
;
}
if
(
opt_slow_logname
&&
!
is_valid_log_name
(
opt_slow_logname
,
strlen
(
opt_slow_logname
)))
{
sql_print_error
(
"Invalid value for --slow_query_log_file: %s"
,
opt_slow_logname
);
return
1
;
}
#define FIX_LOG_VAR(VAR, ALT) \
if (!VAR || !*VAR) \
{ \
...
...
sql/sys_vars.cc
View file @
7679f5f6
/* Copyright (c) 2002, 201
5
, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2002, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -2810,6 +2810,14 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var)
if
(
!
var
->
save_result
.
string_value
.
str
)
return
true
;
if
(
!
is_valid_log_name
(
var
->
save_result
.
string_value
.
str
,
var
->
save_result
.
string_value
.
length
))
{
my_error
(
ER_WRONG_VALUE_FOR_VAR
,
MYF
(
0
),
self
->
name
.
str
,
var
->
save_result
.
string_value
.
str
);
return
true
;
}
if
(
var
->
save_result
.
string_value
.
length
>
FN_REFLEN
)
{
// path is too long
my_error
(
ER_PATH_LENGTH
,
MYF
(
0
),
self
->
name
.
str
);
...
...
@@ -2856,7 +2864,7 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var)
return
false
;
}
static
bool
fix_log
(
char
**
logname
,
const
char
*
default_logname
,
const
char
*
ext
,
bool
enabled
,
void
(
*
reopen
)(
char
*
))
const
char
*
ext
,
bool
enabled
,
bool
(
*
reopen
)(
char
*
))
{
if
(
!*
logname
)
// SET ... = DEFAULT
{
...
...
@@ -2868,16 +2876,17 @@ static bool fix_log(char** logname, const char* default_logname,
}
logger
.
lock_exclusive
();
mysql_mutex_unlock
(
&
LOCK_global_system_variables
);
bool
error
=
false
;
if
(
enabled
)
reopen
(
*
logname
);
error
=
reopen
(
*
logname
);
logger
.
unlock
();
mysql_mutex_lock
(
&
LOCK_global_system_variables
);
return
false
;
return
error
;
}
static
void
reopen_general_log
(
char
*
name
)
static
bool
reopen_general_log
(
char
*
name
)
{
logger
.
get_log_file_handler
()
->
close
(
0
);
logger
.
get_log_file_handler
()
->
open_query_log
(
name
);
return
logger
.
get_log_file_handler
()
->
open_query_log
(
name
);
}
static
bool
fix_general_log_file
(
sys_var
*
self
,
THD
*
thd
,
enum_var_type
type
)
{
...
...
@@ -2890,10 +2899,10 @@ static Sys_var_charptr Sys_general_log_path(
IN_FS_CHARSET
,
DEFAULT
(
0
),
NO_MUTEX_GUARD
,
NOT_IN_BINLOG
,
ON_CHECK
(
check_log_path
),
ON_UPDATE
(
fix_general_log_file
));
static
void
reopen_slow_log
(
char
*
name
)
static
bool
reopen_slow_log
(
char
*
name
)
{
logger
.
get_slow_log_file_handler
()
->
close
(
0
);
logger
.
get_slow_log_file_handler
()
->
open_slow_log
(
name
);
return
logger
.
get_slow_log_file_handler
()
->
open_slow_log
(
name
);
}
static
bool
fix_slow_log_file
(
sys_var
*
self
,
THD
*
thd
,
enum_var_type
type
)
{
...
...
storage/myisam/ha_myisam.cc
View file @
7679f5f6
/*
Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -1091,24 +1091,36 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool do_optimize)
/* TODO: respect myisam_repair_threads variable */
my_snprintf
(
buf
,
40
,
"Repair with %d threads"
,
my_count_bits
(
key_map
));
thd_proc_info
(
thd
,
buf
);
/*
The new file is created with the right stats, so we can skip
copying file stats from old to new.
*/
error
=
mi_repair_parallel
(
&
param
,
file
,
fixed_name
,
param
.
testflag
&
T_QUICK
);
param
.
testflag
&
T_QUICK
,
TRUE
);
thd_proc_info
(
thd
,
"Repair done"
);
// to reset proc_info, as
// it was pointing to local buffer
}
else
{
thd_proc_info
(
thd
,
"Repair by sorting"
);
/*
The new file is created with the right stats, so we can skip
copying file stats from old to new.
*/
error
=
mi_repair_by_sort
(
&
param
,
file
,
fixed_name
,
param
.
testflag
&
T_QUICK
);
param
.
testflag
&
T_QUICK
,
TRUE
);
}
}
else
{
thd_proc_info
(
thd
,
"Repair with keycache"
);
param
.
testflag
&=
~
T_REP_BY_SORT
;
/*
The new file is created with the right stats, so we can skip
copying file stats from old to new.
*/
error
=
mi_repair
(
&
param
,
file
,
fixed_name
,
param
.
testflag
&
T_QUICK
);
param
.
testflag
&
T_QUICK
,
TRUE
);
}
#ifdef HAVE_MMAP
if
(
remap
)
...
...
@@ -1124,7 +1136,11 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool do_optimize)
{
optimize_done
=
1
;
thd_proc_info
(
thd
,
"Sorting index"
);
error
=
mi_sort_index
(
&
param
,
file
,
fixed_name
);
/*
The new file is created with the right stats, so we can skip
copying file stats from old to new.
*/
error
=
mi_sort_index
(
&
param
,
file
,
fixed_name
,
TRUE
);
}
if
(
!
statistics_done
&&
(
local_testflag
&
T_STATISTICS
))
{
...
...
storage/myisam/mi_check.c
View file @
7679f5f6
/*
Copyright (c) 2000, 201
5
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -1512,7 +1512,7 @@ static int mi_drop_all_indexes(MI_CHECK *param, MI_INFO *info, my_bool force)
/* Save new datafile-name in temp_filename */
int
mi_repair
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
,
int
rep_quick
)
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
)
{
int
error
,
got_error
;
ha_rows
start_records
,
new_header_length
;
...
...
@@ -1726,6 +1726,11 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
/* Replace the actual file with the temporary file */
if
(
new_file
>=
0
)
{
myf
flags
=
0
;
if
(
param
->
testflag
&
T_BACKUP_DATA
)
flags
|=
MY_REDEL_MAKE_BACKUP
;
if
(
no_copy_stat
)
flags
|=
MY_REDEL_NO_COPY_STAT
;
mysql_file_close
(
new_file
,
MYF
(
0
));
info
->
dfile
=
new_file
=
-
1
;
/*
...
...
@@ -1744,8 +1749,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
info
->
s
->
file_map
=
NULL
;
}
if
(
change_to_newfile
(
share
->
data_file_name
,
MI_NAME_DEXT
,
DATA_TMP_EXT
,
(
param
->
testflag
&
T_BACKUP_DATA
?
MYF
(
MY_REDEL_MAKE_BACKUP
)
:
MYF
(
0
)))
||
flags
)
||
mi_open_datafile
(
info
,
share
,
name
,
-
1
))
got_error
=
1
;
...
...
@@ -1933,7 +1937,8 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
/* Sort index for more efficent reads */
int
mi_sort_index
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
)
int
mi_sort_index
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
char
*
name
,
my_bool
no_copy_stat
)
{
reg2
uint
key
;
reg1
MI_KEYDEF
*
keyinfo
;
...
...
@@ -2004,7 +2009,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name)
share
->
kfile
=
-
1
;
(
void
)
mysql_file_close
(
new_file
,
MYF
(
MY_WME
));
if
(
change_to_newfile
(
share
->
index_file_name
,
MI_NAME_IEXT
,
INDEX_TMP_EXT
,
MYF
(
0
))
||
no_copy_stat
?
MYF
(
MY_REDEL_NO_COPY_STAT
)
:
MYF
(
0
))
||
mi_open_keyfile
(
share
))
goto
err2
;
info
->
lock_type
=
F_UNLCK
;
/* Force mi_readinfo to lock */
...
...
@@ -2209,6 +2214,8 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
info MyISAM handler to repair
name Name of table (for warnings)
rep_quick set to <> 0 if we should not change data file
no_copy_stat Don't copy file stats from old to new file,
assume that new file was created with correct stats
RESULT
0 ok
...
...
@@ -2216,7 +2223,7 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
*/
int
mi_repair_by_sort
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
)
const
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
)
{
int
got_error
;
uint
i
;
...
...
@@ -2543,11 +2550,15 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
/* Replace the actual file with the temporary file */
if
(
new_file
>=
0
)
{
myf
flags
=
0
;
if
(
param
->
testflag
&
T_BACKUP_DATA
)
flags
|=
MY_REDEL_MAKE_BACKUP
;
if
(
no_copy_stat
)
flags
|=
MY_REDEL_NO_COPY_STAT
;
mysql_file_close
(
new_file
,
MYF
(
0
));
info
->
dfile
=
new_file
=
-
1
;
if
(
change_to_newfile
(
share
->
data_file_name
,
MI_NAME_DEXT
,
DATA_TMP_EXT
,
(
param
->
testflag
&
T_BACKUP_DATA
?
MYF
(
MY_REDEL_MAKE_BACKUP
)
:
MYF
(
0
)))
||
flags
)
||
mi_open_datafile
(
info
,
share
,
name
,
-
1
))
got_error
=
1
;
}
...
...
@@ -2595,6 +2606,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
info MyISAM handler to repair
name Name of table (for warnings)
rep_quick set to <> 0 if we should not change data file
no_copy_stat Don't copy file stats from old to new file,
assume that new file was created with correct stats
DESCRIPTION
Same as mi_repair_by_sort but do it multithreaded
...
...
@@ -2629,7 +2642,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
*/
int
mi_repair_parallel
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
)
const
char
*
name
,
int
rep_quick
,
my_bool
no_copy_stat
)
{
int
got_error
;
uint
i
,
key
,
total_key_length
,
istep
;
...
...
@@ -3076,11 +3089,15 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
/* Replace the actual file with the temporary file */
if
(
new_file
>=
0
)
{
myf
flags
=
0
;
if
(
param
->
testflag
&
T_BACKUP_DATA
)
flags
|=
MY_REDEL_MAKE_BACKUP
;
if
(
no_copy_stat
)
flags
|=
MY_REDEL_NO_COPY_STAT
;
mysql_file_close
(
new_file
,
MYF
(
0
));
info
->
dfile
=
new_file
=
-
1
;
if
(
change_to_newfile
(
share
->
data_file_name
,
MI_NAME_DEXT
,
DATA_TMP_EXT
,
(
param
->
testflag
&
T_BACKUP_DATA
?
MYF
(
MY_REDEL_MAKE_BACKUP
)
:
MYF
(
0
)))
||
flags
)
||
mi_open_datafile
(
info
,
share
,
name
,
-
1
))
got_error
=
1
;
}
...
...
storage/myisam/myisamchk.c
View file @
7679f5f6
/* Copyright (c) 2000, 201
2
, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 201
6
, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -993,14 +993,18 @@ static int myisamchk(MI_CHECK *param, char * filename)
info
->
s
->
state
.
key_map
,
param
->
force_sort
))
{
/*
The new file might not be created with the right stats depending
on how myisamchk is run, so we must copy file stats from old to new.
*/
if
(
param
->
testflag
&
T_REP_BY_SORT
)
error
=
mi_repair_by_sort
(
param
,
info
,
filename
,
rep_quick
);
error
=
mi_repair_by_sort
(
param
,
info
,
filename
,
rep_quick
,
FALSE
);
else
error
=
mi_repair_parallel
(
param
,
info
,
filename
,
rep_quick
);
error
=
mi_repair_parallel
(
param
,
info
,
filename
,
rep_quick
,
FALSE
);
state_updated
=
1
;
}
else
if
(
param
->
testflag
&
T_REP_ANY
)
error
=
mi_repair
(
param
,
info
,
filename
,
rep_quick
);
error
=
mi_repair
(
param
,
info
,
filename
,
rep_quick
,
FALSE
);
}
if
(
!
error
&&
param
->
testflag
&
T_SORT_RECORDS
)
{
...
...
@@ -1040,12 +1044,12 @@ static int myisamchk(MI_CHECK *param, char * filename)
{
if
(
param
->
verbose
)
puts
(
"Table had a compressed index; We must now recreate the index"
);
error
=
mi_repair_by_sort
(
param
,
info
,
filename
,
1
);
error
=
mi_repair_by_sort
(
param
,
info
,
filename
,
1
,
FALSE
);
}
}
}
if
(
!
error
&&
param
->
testflag
&
T_SORT_INDEX
)
error
=
mi_sort_index
(
param
,
info
,
filename
);
error
=
mi_sort_index
(
param
,
info
,
filename
,
FALSE
);
if
(
!
error
)
share
->
state
.
changed
&=
~
(
STATE_CHANGED
|
STATE_CRASHED
|
STATE_CRASHED_ON_REPAIR
);
...
...
support-files/mysql.server.sh
View file @
7679f5f6
...
...
@@ -280,7 +280,7 @@ case "$mode" in
then
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
$bindir
/mysqld_safe
--datadir
=
"
$datadir
"
--pid-file
=
"
$mysqld_pid_file_path
"
$other_args
>
/dev/null
2>&1
&
$bindir
/mysqld_safe
--datadir
=
"
$datadir
"
--pid-file
=
"
$mysqld_pid_file_path
"
$other_args
>
/dev/null &
wait_for_pid created
"
$!
"
"
$mysqld_pid_file_path
"
;
return_value
=
$?
# Make lock for RedHat / SuSE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment