Merge 10.1 into 10.2
This commit is contained in:
commit
2e5aea4bab
@ -6584,8 +6584,6 @@ static inline bool is_escape_char(char c, char in_string)
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
read_line
|
read_line
|
||||||
buf buffer for the read line
|
|
||||||
size size of the buffer i.e max size to read
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This function actually reads several lines and adds them to the
|
This function actually reads several lines and adds them to the
|
||||||
@ -6603,10 +6601,15 @@ static inline bool is_escape_char(char c, char in_string)
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int read_line(char *buf, int size)
|
static char *read_command_buf= NULL;
|
||||||
|
static size_t read_command_buflen= 0;
|
||||||
|
static const size_t max_multibyte_length= 6;
|
||||||
|
|
||||||
|
int read_line()
|
||||||
{
|
{
|
||||||
char c, last_quote=0, last_char= 0;
|
char c, last_quote=0, last_char= 0;
|
||||||
char *p= buf, *buf_end= buf + size - 1;
|
char *p= read_command_buf;
|
||||||
|
char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
|
||||||
int skip_char= 0;
|
int skip_char= 0;
|
||||||
my_bool have_slash= FALSE;
|
my_bool have_slash= FALSE;
|
||||||
|
|
||||||
@ -6614,10 +6617,21 @@ int read_line(char *buf, int size)
|
|||||||
R_COMMENT, R_LINE_START} state= R_LINE_START;
|
R_COMMENT, R_LINE_START} state= R_LINE_START;
|
||||||
DBUG_ENTER("read_line");
|
DBUG_ENTER("read_line");
|
||||||
|
|
||||||
|
*p= 0;
|
||||||
start_lineno= cur_file->lineno;
|
start_lineno= cur_file->lineno;
|
||||||
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
|
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
|
||||||
for (; p < buf_end ;)
|
while (1)
|
||||||
{
|
{
|
||||||
|
if (p >= buf_end)
|
||||||
|
{
|
||||||
|
my_ptrdiff_t off= p - read_command_buf;
|
||||||
|
read_command_buf= (char*)my_realloc(read_command_buf,
|
||||||
|
read_command_buflen*2, MYF(MY_FAE));
|
||||||
|
p= read_command_buf + off;
|
||||||
|
read_command_buflen*= 2;
|
||||||
|
buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
|
||||||
|
}
|
||||||
|
|
||||||
skip_char= 0;
|
skip_char= 0;
|
||||||
c= my_getc(cur_file->file);
|
c= my_getc(cur_file->file);
|
||||||
if (feof(cur_file->file))
|
if (feof(cur_file->file))
|
||||||
@ -6653,7 +6667,7 @@ int read_line(char *buf, int size)
|
|||||||
cur_file->lineno++;
|
cur_file->lineno++;
|
||||||
|
|
||||||
/* Convert cr/lf to lf */
|
/* Convert cr/lf to lf */
|
||||||
if (p != buf && *(p-1) == '\r')
|
if (p != read_command_buf && *(p-1) == '\r')
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6668,9 +6682,9 @@ int read_line(char *buf, int size)
|
|||||||
}
|
}
|
||||||
else if ((c == '{' &&
|
else if ((c == '{' &&
|
||||||
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
|
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
|
||||||
(uchar*) buf, MY_MIN(5, p - buf), 0) ||
|
(uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) ||
|
||||||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
|
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
|
||||||
(uchar*) buf, MY_MIN(2, p - buf), 0))))
|
(uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0))))
|
||||||
{
|
{
|
||||||
/* Only if and while commands can be terminated by { */
|
/* Only if and while commands can be terminated by { */
|
||||||
*p++= c;
|
*p++= c;
|
||||||
@ -6802,8 +6816,6 @@ int read_line(char *buf, int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
die("The input buffer is too small for this query.\n"
|
|
||||||
"check your query or increase MAX_QUERY and recompile");
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6948,12 +6960,8 @@ bool is_delimiter(const char* p)
|
|||||||
terminated by new line '\n' regardless how many "delimiter" it contain.
|
terminated by new line '\n' regardless how many "delimiter" it contain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
|
|
||||||
static char read_command_buf[MAX_QUERY];
|
|
||||||
|
|
||||||
int read_command(struct st_command** command_ptr)
|
int read_command(struct st_command** command_ptr)
|
||||||
{
|
{
|
||||||
char *p= read_command_buf;
|
|
||||||
struct st_command* command;
|
struct st_command* command;
|
||||||
DBUG_ENTER("read_command");
|
DBUG_ENTER("read_command");
|
||||||
|
|
||||||
@ -6969,8 +6977,7 @@ int read_command(struct st_command** command_ptr)
|
|||||||
die("Out of memory");
|
die("Out of memory");
|
||||||
command->type= Q_UNKNOWN;
|
command->type= Q_UNKNOWN;
|
||||||
|
|
||||||
read_command_buf[0]= 0;
|
if (read_line())
|
||||||
if (read_line(read_command_buf, sizeof(read_command_buf)))
|
|
||||||
{
|
{
|
||||||
check_eol_junk(read_command_buf);
|
check_eol_junk(read_command_buf);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@ -6979,6 +6986,7 @@ int read_command(struct st_command** command_ptr)
|
|||||||
if (opt_result_format_version == 1)
|
if (opt_result_format_version == 1)
|
||||||
convert_to_format_v1(read_command_buf);
|
convert_to_format_v1(read_command_buf);
|
||||||
|
|
||||||
|
char *p= read_command_buf;
|
||||||
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
|
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
|
||||||
if (*p == '#')
|
if (*p == '#')
|
||||||
{
|
{
|
||||||
@ -9210,6 +9218,8 @@ int main(int argc, char **argv)
|
|||||||
init_win_path_patterns();
|
init_win_path_patterns();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
|
||||||
|
|
||||||
init_dynamic_string(&ds_res, "", 2048, 2048);
|
init_dynamic_string(&ds_res, "", 2048, 2048);
|
||||||
init_alloc_root(&require_file_root, 1024, 1024, MYF(0));
|
init_alloc_root(&require_file_root, 1024, 1024, MYF(0));
|
||||||
|
|
||||||
|
2
debian/additions/debian-start
vendored
2
debian/additions/debian-start
vendored
@ -13,7 +13,7 @@ fi
|
|||||||
|
|
||||||
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
|
||||||
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
||||||
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
|
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check"
|
||||||
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
|
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
|
||||||
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
|
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
|
||||||
MYCHECK_PARAMS="--all-databases --fast --silent"
|
MYCHECK_PARAMS="--all-databases --fast --silent"
|
||||||
|
8
debian/mariadb-server-10.2.postinst
vendored
8
debian/mariadb-server-10.2.postinst
vendored
@ -2,13 +2,16 @@
|
|||||||
|
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
# assume the filename is /path/to/mariadb-server-##.#.postinst
|
||||||
|
VER=${0: -13:4}
|
||||||
|
|
||||||
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
|
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
|
||||||
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
|
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
|
||||||
|
|
||||||
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
|
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
|
||||||
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
|
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
|
||||||
ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
|
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
|
||||||
# This will make an error in a logged command immediately apparent by aborting
|
# This will make an error in a logged command immediately apparent by aborting
|
||||||
# the install, rather than failing silently and leaving a broken install.
|
# the install, rather than failing silently and leaving a broken install.
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
@ -145,6 +148,9 @@ EOF
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
# To avoid downgrades.
|
||||||
|
touch $mysql_statedir/debian-$VER.flag
|
||||||
|
|
||||||
## On every reconfiguration the maintenance user is recreated.
|
## On every reconfiguration the maintenance user is recreated.
|
||||||
#
|
#
|
||||||
# - It is easier to regenerate the password every time but as people
|
# - It is easier to regenerate the password every time but as people
|
||||||
|
@ -1084,7 +1084,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
|
|||||||
static inline char *dlerror(void)
|
static inline char *dlerror(void)
|
||||||
{
|
{
|
||||||
static char win_errormsg[2048];
|
static char win_errormsg[2048];
|
||||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
0, GetLastError(), 0, win_errormsg, 2048, NULL);
|
0, GetLastError(), 0, win_errormsg, 2048, NULL);
|
||||||
return win_errormsg;
|
return win_errormsg;
|
||||||
}
|
}
|
||||||
|
@ -57,31 +57,6 @@ tpe_crc32.cfg
|
|||||||
tpe_crc32.frm
|
tpe_crc32.frm
|
||||||
tpe_crc32.ibd
|
tpe_crc32.ibd
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_crc32;
|
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_crc32 DISCARD TABLESPACE;
|
|
||||||
restore: tce_crc32 .ibd and .cfg files
|
|
||||||
restore: tc_crc32 .ibd and .cfg files
|
|
||||||
restore: te_crc32 .ibd and .cfg files
|
|
||||||
restore: t_crc32 .ibd and .cfg files
|
|
||||||
restore: tpe_crc32 .ibd and .cfg files
|
|
||||||
restore: tp_crc32 .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_crc32 IMPORT TABLESPACE;
|
|
||||||
update tce_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_crc32 IMPORT TABLESPACE;
|
|
||||||
update tc_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE te_crc32 IMPORT TABLESPACE;
|
|
||||||
update te_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE t_crc32 IMPORT TABLESPACE;
|
|
||||||
update t_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
|
|
||||||
update tpe_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
|
||||||
update tp_crc32 set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=crc32;
|
SET GLOBAL innodb_checksum_algorithm=crc32;
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
||||||
@ -107,31 +82,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
|
|||||||
update tpe_crc32 set b=substr(b,1);
|
update tpe_crc32 set b=substr(b,1);
|
||||||
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
||||||
update tp_crc32 set b=substr(b,1);
|
update tp_crc32 set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_innodb;
|
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_crc32 DISCARD TABLESPACE;
|
|
||||||
restore: tce_crc32 .ibd and .cfg files
|
|
||||||
restore: tc_crc32 .ibd and .cfg files
|
|
||||||
restore: te_crc32 .ibd and .cfg files
|
|
||||||
restore: t_crc32 .ibd and .cfg files
|
|
||||||
restore: tpe_crc32 .ibd and .cfg files
|
|
||||||
restore: tp_crc32 .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_crc32 IMPORT TABLESPACE;
|
|
||||||
update tce_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_crc32 IMPORT TABLESPACE;
|
|
||||||
update tc_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE te_crc32 IMPORT TABLESPACE;
|
|
||||||
update te_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE t_crc32 IMPORT TABLESPACE;
|
|
||||||
update t_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
|
|
||||||
update tpe_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
|
||||||
update tp_crc32 set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=innodb;
|
SET GLOBAL innodb_checksum_algorithm=innodb;
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
||||||
@ -157,31 +107,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
|
|||||||
update tpe_crc32 set b=substr(b,1);
|
update tpe_crc32 set b=substr(b,1);
|
||||||
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
||||||
update tp_crc32 set b=substr(b,1);
|
update tp_crc32 set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_none;
|
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_crc32 DISCARD TABLESPACE;
|
|
||||||
restore: tce_crc32 .ibd and .cfg files
|
|
||||||
restore: tc_crc32 .ibd and .cfg files
|
|
||||||
restore: te_crc32 .ibd and .cfg files
|
|
||||||
restore: t_crc32 .ibd and .cfg files
|
|
||||||
restore: tpe_crc32 .ibd and .cfg files
|
|
||||||
restore: tp_crc32 .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_crc32 IMPORT TABLESPACE;
|
|
||||||
update tce_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_crc32 IMPORT TABLESPACE;
|
|
||||||
update tc_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE te_crc32 IMPORT TABLESPACE;
|
|
||||||
update te_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE t_crc32 IMPORT TABLESPACE;
|
|
||||||
update t_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
|
|
||||||
update tpe_crc32 set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_crc32 IMPORT TABLESPACE;
|
|
||||||
update tp_crc32 set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=none;
|
SET GLOBAL innodb_checksum_algorithm=none;
|
||||||
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
|
||||||
@ -266,31 +191,6 @@ tpe_innodb.cfg
|
|||||||
tpe_innodb.frm
|
tpe_innodb.frm
|
||||||
tpe_innodb.ibd
|
tpe_innodb.ibd
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_crc32;
|
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_innodb DISCARD TABLESPACE;
|
|
||||||
restore: tce_innodb .ibd and .cfg files
|
|
||||||
restore: tc_innodb .ibd and .cfg files
|
|
||||||
restore: te_innodb .ibd and .cfg files
|
|
||||||
restore: t_innodb .ibd and .cfg files
|
|
||||||
restore: tpe_innodb .ibd and .cfg files
|
|
||||||
restore: tp_innodb .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_innodb IMPORT TABLESPACE;
|
|
||||||
update tce_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_innodb IMPORT TABLESPACE;
|
|
||||||
update tc_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE te_innodb IMPORT TABLESPACE;
|
|
||||||
update te_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE t_innodb IMPORT TABLESPACE;
|
|
||||||
update t_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_innodb IMPORT TABLESPACE;
|
|
||||||
update tpe_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
|
||||||
update tp_innodb set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=crc32;
|
SET GLOBAL innodb_checksum_algorithm=crc32;
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
||||||
@ -316,31 +216,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE;
|
|||||||
update tpe_innodb set b=substr(b,1);
|
update tpe_innodb set b=substr(b,1);
|
||||||
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
||||||
update tp_innodb set b=substr(b,1);
|
update tp_innodb set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_innodb;
|
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_innodb DISCARD TABLESPACE;
|
|
||||||
restore: tce_innodb .ibd and .cfg files
|
|
||||||
restore: tc_innodb .ibd and .cfg files
|
|
||||||
restore: te_innodb .ibd and .cfg files
|
|
||||||
restore: t_innodb .ibd and .cfg files
|
|
||||||
restore: tpe_innodb .ibd and .cfg files
|
|
||||||
restore: tp_innodb .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_innodb IMPORT TABLESPACE;
|
|
||||||
update tce_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_innodb IMPORT TABLESPACE;
|
|
||||||
update tc_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE te_innodb IMPORT TABLESPACE;
|
|
||||||
update te_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE t_innodb IMPORT TABLESPACE;
|
|
||||||
update t_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_innodb IMPORT TABLESPACE;
|
|
||||||
update tpe_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
|
||||||
update tp_innodb set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=innodb;
|
SET GLOBAL innodb_checksum_algorithm=innodb;
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
||||||
@ -366,31 +241,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE;
|
|||||||
update tpe_innodb set b=substr(b,1);
|
update tpe_innodb set b=substr(b,1);
|
||||||
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
||||||
update tp_innodb set b=substr(b,1);
|
update tp_innodb set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_none;
|
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_innodb DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_innodb DISCARD TABLESPACE;
|
|
||||||
restore: tce_innodb .ibd and .cfg files
|
|
||||||
restore: tc_innodb .ibd and .cfg files
|
|
||||||
restore: te_innodb .ibd and .cfg files
|
|
||||||
restore: t_innodb .ibd and .cfg files
|
|
||||||
restore: tpe_innodb .ibd and .cfg files
|
|
||||||
restore: tp_innodb .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_innodb IMPORT TABLESPACE;
|
|
||||||
update tce_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_innodb IMPORT TABLESPACE;
|
|
||||||
update tc_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE te_innodb IMPORT TABLESPACE;
|
|
||||||
update te_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE t_innodb IMPORT TABLESPACE;
|
|
||||||
update t_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_innodb IMPORT TABLESPACE;
|
|
||||||
update tpe_innodb set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_innodb IMPORT TABLESPACE;
|
|
||||||
update tp_innodb set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=none;
|
SET GLOBAL innodb_checksum_algorithm=none;
|
||||||
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
ALTER TABLE tce_innodb DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
ALTER TABLE tc_innodb DISCARD TABLESPACE;
|
||||||
@ -475,31 +325,6 @@ tpe_none.cfg
|
|||||||
tpe_none.frm
|
tpe_none.frm
|
||||||
tpe_none.ibd
|
tpe_none.ibd
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_crc32;
|
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_none DISCARD TABLESPACE;
|
|
||||||
restore: tce_none .ibd and .cfg files
|
|
||||||
restore: tc_none .ibd and .cfg files
|
|
||||||
restore: te_none .ibd and .cfg files
|
|
||||||
restore: t_none .ibd and .cfg files
|
|
||||||
restore: tpe_none .ibd and .cfg files
|
|
||||||
restore: tp_none .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_none IMPORT TABLESPACE;
|
|
||||||
update tce_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_none IMPORT TABLESPACE;
|
|
||||||
update tc_none set b=substr(b,1);
|
|
||||||
ALTER TABLE te_none IMPORT TABLESPACE;
|
|
||||||
update te_none set b=substr(b,1);
|
|
||||||
ALTER TABLE t_none IMPORT TABLESPACE;
|
|
||||||
update t_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_none IMPORT TABLESPACE;
|
|
||||||
update tpe_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_none IMPORT TABLESPACE;
|
|
||||||
update tp_none set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=crc32;
|
SET GLOBAL innodb_checksum_algorithm=crc32;
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
ALTER TABLE tce_none DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
ALTER TABLE tc_none DISCARD TABLESPACE;
|
||||||
@ -525,31 +350,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE;
|
|||||||
update tpe_none set b=substr(b,1);
|
update tpe_none set b=substr(b,1);
|
||||||
ALTER TABLE tp_none IMPORT TABLESPACE;
|
ALTER TABLE tp_none IMPORT TABLESPACE;
|
||||||
update tp_none set b=substr(b,1);
|
update tp_none set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_innodb;
|
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_none DISCARD TABLESPACE;
|
|
||||||
restore: tce_none .ibd and .cfg files
|
|
||||||
restore: tc_none .ibd and .cfg files
|
|
||||||
restore: te_none .ibd and .cfg files
|
|
||||||
restore: t_none .ibd and .cfg files
|
|
||||||
restore: tpe_none .ibd and .cfg files
|
|
||||||
restore: tp_none .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_none IMPORT TABLESPACE;
|
|
||||||
update tce_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_none IMPORT TABLESPACE;
|
|
||||||
update tc_none set b=substr(b,1);
|
|
||||||
ALTER TABLE te_none IMPORT TABLESPACE;
|
|
||||||
update te_none set b=substr(b,1);
|
|
||||||
ALTER TABLE t_none IMPORT TABLESPACE;
|
|
||||||
update t_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_none IMPORT TABLESPACE;
|
|
||||||
update tpe_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_none IMPORT TABLESPACE;
|
|
||||||
update tp_none set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=innodb;
|
SET GLOBAL innodb_checksum_algorithm=innodb;
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
ALTER TABLE tce_none DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
ALTER TABLE tc_none DISCARD TABLESPACE;
|
||||||
@ -575,31 +375,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE;
|
|||||||
update tpe_none set b=substr(b,1);
|
update tpe_none set b=substr(b,1);
|
||||||
ALTER TABLE tp_none IMPORT TABLESPACE;
|
ALTER TABLE tp_none IMPORT TABLESPACE;
|
||||||
update tp_none set b=substr(b,1);
|
update tp_none set b=substr(b,1);
|
||||||
SET GLOBAL innodb_checksum_algorithm=strict_none;
|
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE te_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE t_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tpe_none DISCARD TABLESPACE;
|
|
||||||
ALTER TABLE tp_none DISCARD TABLESPACE;
|
|
||||||
restore: tce_none .ibd and .cfg files
|
|
||||||
restore: tc_none .ibd and .cfg files
|
|
||||||
restore: te_none .ibd and .cfg files
|
|
||||||
restore: t_none .ibd and .cfg files
|
|
||||||
restore: tpe_none .ibd and .cfg files
|
|
||||||
restore: tp_none .ibd and .cfg files
|
|
||||||
ALTER TABLE tce_none IMPORT TABLESPACE;
|
|
||||||
update tce_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tc_none IMPORT TABLESPACE;
|
|
||||||
update tc_none set b=substr(b,1);
|
|
||||||
ALTER TABLE te_none IMPORT TABLESPACE;
|
|
||||||
update te_none set b=substr(b,1);
|
|
||||||
ALTER TABLE t_none IMPORT TABLESPACE;
|
|
||||||
update t_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tpe_none IMPORT TABLESPACE;
|
|
||||||
update tpe_none set b=substr(b,1);
|
|
||||||
ALTER TABLE tp_none IMPORT TABLESPACE;
|
|
||||||
update tp_none set b=substr(b,1);
|
|
||||||
SET GLOBAL innodb_checksum_algorithm=none;
|
SET GLOBAL innodb_checksum_algorithm=none;
|
||||||
ALTER TABLE tce_none DISCARD TABLESPACE;
|
ALTER TABLE tce_none DISCARD TABLESPACE;
|
||||||
ALTER TABLE tc_none DISCARD TABLESPACE;
|
ALTER TABLE tc_none DISCARD TABLESPACE;
|
||||||
|
@ -65,17 +65,14 @@ EOF
|
|||||||
--list_files $MYSQLD_DATADIR/test
|
--list_files $MYSQLD_DATADIR/test
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
let $to = 6;
|
let $to = 3;
|
||||||
while ($to)
|
while ($to)
|
||||||
{
|
{
|
||||||
dec $to;
|
dec $to;
|
||||||
let $tocksum = `select case $to
|
let $tocksum = `select case $to
|
||||||
when 0 then 'none'
|
when 0 then 'none'
|
||||||
when 1 then 'strict_none'
|
when 1 then 'innodb'
|
||||||
when 2 then 'innodb'
|
when 2 then 'crc32'
|
||||||
when 3 then 'strict_innodb'
|
|
||||||
when 4 then 'crc32'
|
|
||||||
when 5 then 'strict_crc32'
|
|
||||||
end`;
|
end`;
|
||||||
|
|
||||||
eval SET GLOBAL innodb_checksum_algorithm=$tocksum;
|
eval SET GLOBAL innodb_checksum_algorithm=$tocksum;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
--skip-innodb-doublewrite
|
--skip-innodb-doublewrite
|
||||||
--innodb-file-per-table
|
--innodb-file-per-table
|
||||||
--innodb-file-format=Barracuda
|
--innodb-file-format=Barracuda
|
||||||
|
--innodb_checksum_algorithm=crc32
|
||||||
|
@ -79,18 +79,22 @@ let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --
|
|||||||
|
|
||||||
--echo [9]: check the innochecksum with full form --strict-check=innodb
|
--echo [9]: check the innochecksum with full form --strict-check=innodb
|
||||||
# Server Default checksum = crc32
|
# Server Default checksum = crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [10]: check the innochecksum with full form --strict-check=none
|
--echo [10]: check the innochecksum with full form --strict-check=none
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [11]: check the innochecksum with short form -C innodb
|
--echo [11]: check the innochecksum with short form -C innodb
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [12]: check the innochecksum with short form -C none
|
--echo [12]: check the innochecksum with short form -C none
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [13]: check strict-check with invalid values
|
--echo [13]: check strict-check with invalid values
|
||||||
|
@ -79,18 +79,22 @@ let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --
|
|||||||
|
|
||||||
--echo [9]: check the innochecksum with full form --strict-check=innodb
|
--echo [9]: check the innochecksum with full form --strict-check=innodb
|
||||||
# Server Default checksum = crc32
|
# Server Default checksum = crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [10]: check the innochecksum with full form --strict-check=none
|
--echo [10]: check the innochecksum with full form --strict-check=none
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [11]: check the innochecksum with short form -C innodb
|
--echo [11]: check the innochecksum with short form -C innodb
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [12]: check the innochecksum with short form -C none
|
--echo [12]: check the innochecksum with short form -C none
|
||||||
--echo # when server Default checksum=crc32
|
--echo # when server Default checksum=crc32
|
||||||
|
--error 1
|
||||||
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
|
||||||
|
|
||||||
--echo [13]: check strict-check with invalid values
|
--echo [13]: check strict-check with invalid values
|
||||||
|
@ -437,7 +437,7 @@ while (1)
|
|||||||
|
|
||||||
if ($key eq 'C')
|
if ($key eq 'C')
|
||||||
{
|
{
|
||||||
if ( $HAS_COLOR )
|
if ( $HAS_COLOR )
|
||||||
{
|
{
|
||||||
$HAS_COLOR = 0;
|
$HAS_COLOR = 0;
|
||||||
}
|
}
|
||||||
@ -817,11 +817,11 @@ sub GetData()
|
|||||||
if ($config{header})
|
if ($config{header})
|
||||||
{
|
{
|
||||||
my @recs = "";
|
my @recs = "";
|
||||||
if ( $db_release > 4 )
|
if ( $db_release > 4 )
|
||||||
{
|
{
|
||||||
@recs = Hashes("show global status");
|
@recs = Hashes("show global status");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@recs = Hashes("show status");
|
@recs = Hashes("show status");
|
||||||
}
|
}
|
||||||
@ -978,7 +978,7 @@ sub GetData()
|
|||||||
# print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n");
|
# print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n");
|
||||||
|
|
||||||
printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f\n",
|
printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f\n",
|
||||||
( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta,
|
( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta,
|
||||||
( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta,
|
( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta,
|
||||||
( # slow now (qps)
|
( # slow now (qps)
|
||||||
($STATUS{Slow_queries} ) ?
|
($STATUS{Slow_queries} ) ?
|
||||||
@ -989,7 +989,7 @@ sub GetData()
|
|||||||
$STATUS{Threads_running},
|
$STATUS{Threads_running},
|
||||||
$STATUS{Threads_cached},
|
$STATUS{Threads_cached},
|
||||||
|
|
||||||
(100 * ($STATUS{Com_select} - $OLD_STATUS{Com_select} +
|
(100 * ($STATUS{Com_select} - $OLD_STATUS{Com_select} +
|
||||||
($STATUS{Qcache_hits}||0) - ($OLD_STATUS{Qcache_hits}||0)
|
($STATUS{Qcache_hits}||0) - ($OLD_STATUS{Qcache_hits}||0)
|
||||||
) ) / ($q_diff ),
|
) ) / ($q_diff ),
|
||||||
(100 * ($STATUS{Com_insert} - $OLD_STATUS{Com_insert} +
|
(100 * ($STATUS{Com_insert} - $OLD_STATUS{Com_insert} +
|
||||||
@ -1075,7 +1075,7 @@ sub GetData()
|
|||||||
$t_delta,
|
$t_delta,
|
||||||
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
|
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
|
||||||
$t_delta,
|
$t_delta,
|
||||||
($STATUS{Handler_tmp_write}
|
($STATUS{Handler_tmp_write}
|
||||||
-$OLD_STATUS{Handler_tmp_write})/$t_delta,
|
-$OLD_STATUS{Handler_tmp_write})/$t_delta,
|
||||||
($STATUS{Handler_tmp_update} -
|
($STATUS{Handler_tmp_update} -
|
||||||
$OLD_STATUS{Handler_tmp_update})/$t_delta);
|
$OLD_STATUS{Handler_tmp_update})/$t_delta);
|
||||||
@ -1119,6 +1119,7 @@ sub GetData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print " Replication ";
|
print " Replication ";
|
||||||
|
print "Master:$data->{Master_Host} ";
|
||||||
print "IO:$data->{Slave_IO_Running} ";
|
print "IO:$data->{Slave_IO_Running} ";
|
||||||
print "SQL:$data->{Slave_SQL_Running} ";
|
print "SQL:$data->{Slave_SQL_Running} ";
|
||||||
print RESET() if ($HAS_COLOR);
|
print RESET() if ($HAS_COLOR);
|
||||||
@ -1225,9 +1226,9 @@ sub GetData()
|
|||||||
$thread->{State} ||= "";
|
$thread->{State} ||= "";
|
||||||
$thread->{Progress} ||= 0;
|
$thread->{Progress} ||= 0;
|
||||||
|
|
||||||
## alter double hyphen comments so they don't break
|
## alter double hyphen comments so they don't break
|
||||||
## the query when newlines are removed - http://freshmeat.net/users/jerjones
|
## the query when newlines are removed - http://freshmeat.net/users/jerjones
|
||||||
$thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
|
$thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
|
||||||
|
|
||||||
## Normalize spaces -- mostly disabled for now. This can
|
## Normalize spaces -- mostly disabled for now. This can
|
||||||
## break EXPLAIN if you try to explain a mangled query. It
|
## break EXPLAIN if you try to explain a mangled query. It
|
||||||
|
@ -3744,10 +3744,10 @@ void set_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
Ideally, EITS should provide per-partition statistics but this is not
|
Ideally, EITS should provide per-partition statistics but this is not
|
||||||
implemented currently.
|
implemented currently.
|
||||||
*/
|
*/
|
||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||||
if (table->part_info)
|
if (table->part_info)
|
||||||
table->used_stat_records= table->file->stats.records;
|
table->used_stat_records= table->file->stats.records;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
KEY *key_info, *key_info_end;
|
KEY *key_info, *key_info_end;
|
||||||
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
|
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
|
||||||
@ -4077,10 +4077,6 @@ bool is_stat_table(const char *db, const char *table)
|
|||||||
|
|
||||||
bool is_eits_usable(Field *field)
|
bool is_eits_usable(Field *field)
|
||||||
{
|
{
|
||||||
partition_info *part_info= NULL;
|
|
||||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
|
||||||
part_info= field->table->part_info;
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
(1): checks if we have EITS statistics for a particular column
|
(1): checks if we have EITS statistics for a particular column
|
||||||
(2): Don't use EITS for GEOMETRY columns
|
(2): Don't use EITS for GEOMETRY columns
|
||||||
@ -4089,9 +4085,11 @@ bool is_eits_usable(Field *field)
|
|||||||
such columns would be handled during partition pruning.
|
such columns would be handled during partition pruning.
|
||||||
*/
|
*/
|
||||||
Column_statistics* col_stats= field->read_stats;
|
Column_statistics* col_stats= field->read_stats;
|
||||||
if (col_stats && !col_stats->no_stat_values_provided() && //(1)
|
return col_stats && !col_stats->no_stat_values_provided() && //(1)
|
||||||
field->type() != MYSQL_TYPE_GEOMETRY && //(2)
|
field->type() != MYSQL_TYPE_GEOMETRY && //(2)
|
||||||
(!part_info || !part_info->field_in_partition_expr(field))) //(3)
|
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||||
return TRUE;
|
(!field->table->part_info ||
|
||||||
return FALSE;
|
!field->table->part_info->field_in_partition_expr(field)) && //(3)
|
||||||
|
#endif
|
||||||
|
true;
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ buf_page_is_checksum_valid_crc32(
|
|||||||
#endif /* UNIV_INNOCHECKSUM */
|
#endif /* UNIV_INNOCHECKSUM */
|
||||||
|
|
||||||
if (checksum_field1 != checksum_field2) {
|
if (checksum_field1 != checksum_field2) {
|
||||||
goto invalid;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checksum_field1 == crc32) {
|
if (checksum_field1 == crc32) {
|
||||||
@ -793,11 +793,6 @@ buf_page_is_checksum_valid_crc32(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid:
|
|
||||||
DBUG_LOG("checksum", "Page checksum crc32 not valid"
|
|
||||||
<< " field1 " << checksum_field1
|
|
||||||
<< " field2 " << checksum_field2
|
|
||||||
<< " crc32 " << crc32);
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,18 +939,21 @@ buf_page_is_corrupted(
|
|||||||
const void* space)
|
const void* space)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
size_t checksum_field1 = 0;
|
|
||||||
size_t checksum_field2 = 0;
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
|
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
|
||||||
#endif
|
#endif
|
||||||
|
size_t checksum_field1 = 0;
|
||||||
|
size_t checksum_field2 = 0;
|
||||||
|
uint32_t crc32 = 0;
|
||||||
|
bool crc32_inited = false;
|
||||||
|
|
||||||
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
|
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
|
||||||
|
|
||||||
/* We can trust page type if page compression is set on tablespace
|
/* We can trust page type if page compression is set on tablespace
|
||||||
flags because page compression flag means file must have been
|
flags because page compression flag means file must have been
|
||||||
created with 10.1 (later than 5.5 code base). In 10.1 page
|
created with 10.1 (later than 5.5 code base). In 10.1 page
|
||||||
compressed tables do not contain post compression checksum and
|
compressed tables do not contain post compression checksum and
|
||||||
FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
|
FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can
|
||||||
be null if we are in fil_check_first_page() and first page
|
be null if we are in fil_check_first_page() and first page
|
||||||
is not compressed or encrypted. Page checksum is verified
|
is not compressed or encrypted. Page checksum is verified
|
||||||
after decompression (i.e. normally pages are already
|
after decompression (i.e. normally pages are already
|
||||||
@ -976,13 +974,7 @@ buf_page_is_corrupted(
|
|||||||
|
|
||||||
/* Stored log sequence numbers at the start and the end
|
/* Stored log sequence numbers at the start and the end
|
||||||
of page do not match */
|
of page do not match */
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
ib::info() << "Log sequence number at the start "
|
|
||||||
<< mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
|
||||||
<< " and the end "
|
|
||||||
<< mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)
|
|
||||||
<< " do not match";
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1048,21 +1040,9 @@ buf_page_is_corrupted(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
/* make sure that the page is really empty */
|
/* make sure that the page is really empty */
|
||||||
for (i = 0; i < page_size.logical(); ++i) {
|
for (ulint i = 0; i < UNIV_PAGE_SIZE; i++) {
|
||||||
|
if (read_buf[i] != 0) {
|
||||||
/* The FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID has been
|
return(true);
|
||||||
repurposed for page compression. It can be
|
|
||||||
set for uncompressed empty pages. */
|
|
||||||
|
|
||||||
if ((i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
|
||||||
|| i >= FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)
|
|
||||||
&& read_buf[i] != 0) {
|
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
ib::info() << "Checksum fields zero but page is not empty.";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
#ifdef UNIV_INNOCHECKSUM
|
||||||
@ -1079,39 +1059,26 @@ buf_page_is_corrupted(
|
|||||||
#endif /* UNIV_INNOCHECKSUM */
|
#endif /* UNIV_INNOCHECKSUM */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
const page_id_t page_id(mach_read_from_4(
|
|
||||||
read_buf + FIL_PAGE_SPACE_ID),
|
|
||||||
mach_read_from_4(
|
|
||||||
read_buf + FIL_PAGE_OFFSET));
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
const srv_checksum_algorithm_t curr_algo =
|
const srv_checksum_algorithm_t curr_algo =
|
||||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||||
|
|
||||||
bool legacy_checksum_checked = false;
|
|
||||||
|
|
||||||
switch (curr_algo) {
|
switch (curr_algo) {
|
||||||
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
|
return !buf_page_is_checksum_valid_crc32(
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
read_buf, checksum_field1, checksum_field2, false)
|
||||||
checksum_field1, checksum_field2, false)) {
|
&& !buf_page_is_checksum_valid_crc32(
|
||||||
return(false);
|
read_buf, checksum_field1, checksum_field2,
|
||||||
}
|
true);
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
|
return !buf_page_is_checksum_valid_innodb(
|
||||||
|
read_buf, checksum_field1, checksum_field2);
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
return !buf_page_is_checksum_valid_none(
|
||||||
|
read_buf, checksum_field1, checksum_field2);
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
if (buf_page_is_checksum_valid_none(read_buf,
|
||||||
checksum_field1, checksum_field2)) {
|
checksum_field1, checksum_field2)) {
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
page_id);
|
|
||||||
#endif /* !UNIV_INNOCHECKSUM */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
#ifdef UNIV_INNOCHECKSUM
|
||||||
if (log_file) {
|
if (log_file) {
|
||||||
fprintf(log_file, "page::%llu;"
|
fprintf(log_file, "page::%llu;"
|
||||||
@ -1129,173 +1096,133 @@ buf_page_is_corrupted(
|
|||||||
checksum_field1);
|
checksum_field1);
|
||||||
}
|
}
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
#endif /* UNIV_INNOCHECKSUM */
|
||||||
|
return false;
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to check whether the stored checksum matches legacy
|
/* Very old versions of InnoDB only stored 8 byte lsn to the
|
||||||
big endian checksum or Innodb checksum. We optimize the order
|
start and the end of the page. */
|
||||||
based on earlier results. if earlier we have found pages
|
|
||||||
matching legacy big endian checksum, we try to match it first.
|
|
||||||
Otherwise we check innodb checksum first. */
|
|
||||||
if (legacy_big_endian_checksum) {
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
|
||||||
checksum_field1, checksum_field2, true)) {
|
|
||||||
|
|
||||||
return(false);
|
/* Since innodb_checksum_algorithm is not strict_* allow
|
||||||
|
any of the algos to match for the old field */
|
||||||
|
|
||||||
|
if (checksum_field2
|
||||||
|
!= mach_read_from_4(read_buf + FIL_PAGE_LSN)
|
||||||
|
&& checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
|
||||||
|
|
||||||
|
if (srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_CRC32) {
|
||||||
|
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf, legacy_big_endian_checksum);
|
||||||
|
crc32_inited = true;
|
||||||
|
|
||||||
|
if (!legacy_big_endian_checksum
|
||||||
|
&& checksum_field2 != crc32) {
|
||||||
|
crc32 = buf_calc_page_crc32(read_buf,
|
||||||
|
true);
|
||||||
|
legacy_big_endian_checksum =
|
||||||
|
checksum_field2 == crc32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksum_field2 != crc32
|
||||||
|
&& checksum_field2
|
||||||
|
!= buf_calc_page_old_checksum(read_buf)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ut_ad(srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_INNODB);
|
||||||
|
|
||||||
|
if (checksum_field2
|
||||||
|
!= buf_calc_page_old_checksum(read_buf)) {
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf,
|
||||||
|
legacy_big_endian_checksum);
|
||||||
|
crc32_inited = true;
|
||||||
|
|
||||||
|
if (!legacy_big_endian_checksum
|
||||||
|
&& checksum_field2 != crc32) {
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf, true);
|
||||||
|
legacy_big_endian_checksum =
|
||||||
|
checksum_field2 == crc32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksum_field2 != crc32) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
legacy_checksum_checked = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
if (checksum_field1 == 0
|
||||||
checksum_field1, checksum_field2)) {
|
|| checksum_field1 == BUF_NO_CHECKSUM_MAGIC) {
|
||||||
if (curr_algo
|
} else if (srv_checksum_algorithm
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
== SRV_CHECKSUM_ALGORITHM_CRC32) {
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
if (!crc32_inited) {
|
||||||
curr_algo,
|
crc32 = buf_calc_page_crc32(
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
read_buf,
|
||||||
page_id);
|
legacy_big_endian_checksum);
|
||||||
#endif
|
crc32_inited = true;
|
||||||
|
|
||||||
|
if (!legacy_big_endian_checksum
|
||||||
|
&& checksum_field2 != crc32) {
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf, true);
|
||||||
|
legacy_big_endian_checksum =
|
||||||
|
checksum_field2 == crc32;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(false);
|
if (checksum_field1 != crc32
|
||||||
}
|
&& checksum_field1
|
||||||
|
!= buf_calc_page_new_checksum(read_buf)) {
|
||||||
/* If legacy checksum is not checked, do it now. */
|
return true;
|
||||||
if (!legacy_checksum_checked && buf_page_is_checksum_valid_crc32(
|
|
||||||
read_buf, checksum_field1, checksum_field2, true)) {
|
|
||||||
|
|
||||||
legacy_big_endian_checksum = true;
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
|
||||||
if (log_file) {
|
|
||||||
fprintf(log_file, "Fail; page::%llu;"
|
|
||||||
" invalid (fails crc32 checksum)\n",
|
|
||||||
cur_page_num);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
page_id);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
} else {
|
||||||
if (log_file) {
|
ut_ad(srv_checksum_algorithm
|
||||||
fprintf(log_file, "page::%llu;"
|
== SRV_CHECKSUM_ALGORITHM_INNODB);
|
||||||
" old style: calculated = %u;"
|
|
||||||
" recorded = %zu;\n", cur_page_num,
|
if (checksum_field1
|
||||||
buf_calc_page_old_checksum(read_buf),
|
!= buf_calc_page_new_checksum(read_buf)) {
|
||||||
checksum_field2);
|
|
||||||
fprintf(log_file, "page::%llu;"
|
if (!crc32_inited) {
|
||||||
" new style: calculated = %u;"
|
crc32 = buf_calc_page_crc32(
|
||||||
" crc32 = %u; recorded = %zu;\n",
|
read_buf,
|
||||||
cur_page_num,
|
legacy_big_endian_checksum);
|
||||||
buf_calc_page_new_checksum(read_buf),
|
crc32_inited = true;
|
||||||
buf_calc_page_crc32(read_buf),
|
|
||||||
checksum_field1);
|
if (!legacy_big_endian_checksum
|
||||||
|
&& checksum_field2 != crc32) {
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf, true);
|
||||||
|
legacy_big_endian_checksum =
|
||||||
|
checksum_field2 == crc32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksum_field1 != crc32) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
if (crc32_inited
|
||||||
checksum_field1, checksum_field2, false)
|
&& ((checksum_field1 == crc32
|
||||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
&& checksum_field2 != crc32)
|
||||||
checksum_field1, checksum_field2, true)) {
|
|| (checksum_field1 != crc32
|
||||||
|
&& checksum_field2 == crc32))) {
|
||||||
if (curr_algo
|
return true;
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
page_id);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
break;
|
||||||
if (log_file) {
|
|
||||||
fprintf(log_file, "Fail; page::%llu;"
|
|
||||||
" invalid (fails innodb checksum)\n",
|
|
||||||
cur_page_num);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
|
||||||
checksum_field1, checksum_field2, false)
|
|
||||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
|
||||||
checksum_field1, checksum_field2, true)) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
page_id);
|
|
||||||
#endif /* !UNIV_INNOCHECKSUM */
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
page_id);
|
|
||||||
#endif /* !UNIV_INNOCHECKSUM */
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
|
||||||
if (log_file) {
|
|
||||||
fprintf(log_file, "Fail; page::%llu;"
|
|
||||||
" invalid (fails none checksum)\n",
|
|
||||||
cur_page_num);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_NONE:
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
/* should have returned false earlier */
|
/* should have returned false earlier */
|
||||||
break;
|
break;
|
||||||
/* no default so the compiler will emit a warning if new enum
|
|
||||||
is added and not handled here */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_error;
|
return false;
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
#ifndef UNIV_INNOCHECKSUM
|
||||||
|
@ -2622,7 +2622,7 @@ fil_space_verify_crypt_checksum(
|
|||||||
uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
|
uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
|
||||||
uint32_t checksum2;
|
uint32_t checksum2;
|
||||||
|
|
||||||
bool valid;
|
bool valid = false;
|
||||||
|
|
||||||
if (page_size.is_compressed()) {
|
if (page_size.is_compressed()) {
|
||||||
valid = checksum1 == cchecksum1;
|
valid = checksum1 == cchecksum1;
|
||||||
@ -2630,12 +2630,36 @@ fil_space_verify_crypt_checksum(
|
|||||||
} else {
|
} else {
|
||||||
checksum2 = mach_read_from_4(
|
checksum2 = mach_read_from_4(
|
||||||
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||||
valid = buf_page_is_checksum_valid_crc32(
|
|
||||||
page, checksum1, checksum2, false
|
srv_checksum_algorithm_t algorithm =
|
||||||
/* FIXME: also try the original crc32 that was
|
static_cast<srv_checksum_algorithm_t>(
|
||||||
buggy on big-endian architectures? */)
|
srv_checksum_algorithm);
|
||||||
|| buf_page_is_checksum_valid_innodb(
|
switch (algorithm) {
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
|
/* We never supported upgrade from the "legacy crc32"
|
||||||
|
on big endian systems from MariaDB 10.1 to later. */
|
||||||
|
valid = buf_page_is_checksum_valid_crc32(
|
||||||
|
page, checksum1, checksum2, false);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
|
valid = buf_page_is_checksum_valid_innodb(
|
||||||
page, checksum1, checksum2);
|
page, checksum1, checksum2);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
|
/* We never supported upgrade from the "legacy crc32"
|
||||||
|
on big endian systems from MariaDB 10.1 to later.
|
||||||
|
We also never supported
|
||||||
|
innodb_checksum_algorithm=none or strict_none
|
||||||
|
for encrypted pages. */
|
||||||
|
valid = buf_page_is_checksum_valid_crc32(
|
||||||
|
page, checksum1, checksum2, false)
|
||||||
|
|| buf_page_is_checksum_valid_innodb(
|
||||||
|
page, checksum1, checksum2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encrypted && valid) {
|
if (encrypted && valid) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2013, 2017, MariaDB Corporation.
|
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
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 the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -1229,17 +1229,6 @@ const rec_t*
|
|||||||
page_find_rec_max_not_deleted(
|
page_find_rec_max_not_deleted(
|
||||||
const page_t* page);
|
const page_t* page);
|
||||||
|
|
||||||
/** Issue a warning when the checksum that is stored in the page is valid,
|
|
||||||
but different than the global setting innodb_checksum_algorithm.
|
|
||||||
@param[in] current_algo current checksum algorithm
|
|
||||||
@param[in] page_checksum page valid checksum
|
|
||||||
@param[in] page_id page identifier */
|
|
||||||
void
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
srv_checksum_algorithm_t curr_algo,
|
|
||||||
srv_checksum_algorithm_t page_checksum,
|
|
||||||
const page_id_t page_id);
|
|
||||||
|
|
||||||
#ifdef UNIV_MATERIALIZE
|
#ifdef UNIV_MATERIALIZE
|
||||||
#undef UNIV_INLINE
|
#undef UNIV_INLINE
|
||||||
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
|
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
|
||||||
|
@ -2823,42 +2823,3 @@ page_find_rec_max_not_deleted(
|
|||||||
}
|
}
|
||||||
return(prev_rec);
|
return(prev_rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Issue a warning when the checksum that is stored in the page is valid,
|
|
||||||
but different than the global setting innodb_checksum_algorithm.
|
|
||||||
@param[in] current_algo current checksum algorithm
|
|
||||||
@param[in] page_checksum page valid checksum
|
|
||||||
@param[in] page_id page identifier */
|
|
||||||
void
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
srv_checksum_algorithm_t curr_algo,
|
|
||||||
srv_checksum_algorithm_t page_checksum,
|
|
||||||
const page_id_t page_id)
|
|
||||||
{
|
|
||||||
srv_checksum_algorithm_t curr_algo_nonstrict;
|
|
||||||
switch (curr_algo) {
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ib::warn() << "innodb_checksum_algorithm is set to \""
|
|
||||||
<< buf_checksum_algorithm_name(curr_algo) << "\""
|
|
||||||
<< " but the page " << page_id << " contains a valid checksum \""
|
|
||||||
<< buf_checksum_algorithm_name(page_checksum) << "\". "
|
|
||||||
<< " Accepting the page as valid. Change"
|
|
||||||
<< " innodb_checksum_algorithm to \""
|
|
||||||
<< buf_checksum_algorithm_name(curr_algo_nonstrict)
|
|
||||||
<< "\" to silently accept such pages or rewrite all pages"
|
|
||||||
<< " so that they contain \""
|
|
||||||
<< buf_checksum_algorithm_name(curr_algo_nonstrict)
|
|
||||||
<< "\" checksum.";
|
|
||||||
}
|
|
||||||
|
@ -4986,18 +4986,12 @@ page_zip_verify_checksum(
|
|||||||
{
|
{
|
||||||
ib_uint32_t stored;
|
ib_uint32_t stored;
|
||||||
ib_uint32_t calc;
|
ib_uint32_t calc;
|
||||||
|
ib_uint32_t crc32 = 0;
|
||||||
|
ib_uint32_t innodb = 0;
|
||||||
|
|
||||||
stored = static_cast<ib_uint32_t>(mach_read_from_4(
|
stored = static_cast<ib_uint32_t>(mach_read_from_4(
|
||||||
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
|
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
|
||||||
|
|
||||||
ulint page_no MY_ATTRIBUTE((unused)) =
|
|
||||||
mach_read_from_4(static_cast<const unsigned char*>
|
|
||||||
(data) + FIL_PAGE_OFFSET);
|
|
||||||
ulint space_id MY_ATTRIBUTE((unused)) =
|
|
||||||
mach_read_from_4(static_cast<const unsigned char*>
|
|
||||||
(data) + FIL_PAGE_SPACE_ID);
|
|
||||||
const page_id_t page_id(space_id, page_no);
|
|
||||||
|
|
||||||
#if FIL_PAGE_LSN % 8
|
#if FIL_PAGE_LSN % 8
|
||||||
#error "FIL_PAGE_LSN must be 64 bit aligned"
|
#error "FIL_PAGE_LSN must be 64 bit aligned"
|
||||||
#endif
|
#endif
|
||||||
@ -5074,149 +5068,46 @@ page_zip_verify_checksum(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool legacy_checksum_checked = false;
|
|
||||||
|
|
||||||
switch (curr_algo) {
|
switch (curr_algo) {
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
case SRV_CHECKSUM_ALGORITHM_CRC32: {
|
calc = page_zip_calc_checksum(data, size, curr_algo, true);
|
||||||
|
if (calc == stored) {
|
||||||
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
page_id);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We need to check whether the stored checksum matches legacy
|
|
||||||
big endian checksum or Innodb checksum. We optimize the order
|
|
||||||
based on earlier results. if earlier we have found pages
|
|
||||||
matching legacy big endian checksum, we try to match it first.
|
|
||||||
Otherwise we check innodb checksum first. */
|
|
||||||
if (legacy_big_endian_checksum) {
|
|
||||||
const uint32_t calculated =
|
|
||||||
page_zip_calc_checksum(data, size, curr_algo, true);
|
|
||||||
if (stored == calculated) {
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
legacy_checksum_checked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t calculated =
|
|
||||||
page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
|
|
||||||
|
|
||||||
if (stored == calculated) {
|
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
page_id);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
calculated = page_zip_calc_checksum(
|
|
||||||
data, size, curr_algo, true);
|
|
||||||
|
|
||||||
/* If legacy checksum is not checked, do it now. */
|
|
||||||
if ((legacy_checksum_checked
|
|
||||||
&& stored == calculated)) {
|
|
||||||
legacy_big_endian_checksum = true;
|
legacy_big_endian_checksum = true;
|
||||||
return(TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
return FALSE;
|
||||||
}
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
case SRV_CHECKSUM_ALGORITHM_INNODB: {
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
return FALSE;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
page_id);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t calculated = page_zip_calc_checksum(
|
calc = page_zip_calc_checksum(data, size, curr_algo, true);
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|
crc32 = calc;
|
||||||
uint32_t calculated1;
|
|
||||||
|
|
||||||
if (stored == calculated
|
if (crc32 == stored) {
|
||||||
|| stored == (calculated1 =
|
legacy_big_endian_checksum = true;
|
||||||
page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true))
|
return TRUE;
|
||||||
) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
page_id);
|
|
||||||
}
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
||||||
|
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
|
||||||
break;
|
break;
|
||||||
}
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: {
|
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
||||||
|
return TRUE;
|
||||||
uint32_t calculated = page_zip_calc_checksum(
|
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|
|
||||||
const uint32_t calculated1 = page_zip_calc_checksum(
|
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32, true);
|
|
||||||
|
|
||||||
if (stored == calculated
|
|
||||||
|| stored == calculated1) {
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
page_id);
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
calculated = page_zip_calc_checksum(
|
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
|
|
||||||
|
|
||||||
if (stored == calculated) {
|
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
page_id);
|
|
||||||
#endif /* UNIV_INNOCHECKSUM */
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
||||||
|
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
|
||||||
|
innodb = calc;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_NONE:
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
ut_error;
|
return TRUE;
|
||||||
/* no default so the compiler will emit a warning if new enum
|
|
||||||
is added and not handled here */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(FALSE);
|
return (stored == crc32 || stored == innodb);
|
||||||
}
|
}
|
||||||
|
@ -868,10 +868,9 @@ buf_page_is_corrupted(
|
|||||||
|
|
||||||
ulint checksum_field1;
|
ulint checksum_field1;
|
||||||
ulint checksum_field2;
|
ulint checksum_field2;
|
||||||
ulint space_id = mach_read_from_4(
|
bool crc32_inited = false;
|
||||||
read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
ib_uint32_t crc32 = ULINT32_UNDEFINED;
|
||||||
ulint page_type = mach_read_from_2(
|
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
|
||||||
read_buf + FIL_PAGE_TYPE);
|
|
||||||
|
|
||||||
/* We can trust page type if page compression is set on tablespace
|
/* We can trust page type if page compression is set on tablespace
|
||||||
flags because page compression flag means file must have been
|
flags because page compression flag means file must have been
|
||||||
@ -896,12 +895,7 @@ buf_page_is_corrupted(
|
|||||||
/* Stored log sequence numbers at the start and the end
|
/* Stored log sequence numbers at the start and the end
|
||||||
of page do not match */
|
of page do not match */
|
||||||
|
|
||||||
ib_logf(IB_LOG_LEVEL_INFO,
|
return(true);
|
||||||
"Log sequence number at the start %lu and the end %lu do not match.",
|
|
||||||
mach_read_from_4(read_buf + FIL_PAGE_LSN + 4),
|
|
||||||
mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM + 4));
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
@ -964,9 +958,6 @@ buf_page_is_corrupted(
|
|||||||
/* make sure that the page is really empty */
|
/* make sure that the page is really empty */
|
||||||
for (ulint i = 0; i < UNIV_PAGE_SIZE; i++) {
|
for (ulint i = 0; i < UNIV_PAGE_SIZE; i++) {
|
||||||
if (read_buf[i] != 0) {
|
if (read_buf[i] != 0) {
|
||||||
ib_logf(IB_LOG_LEVEL_INFO,
|
|
||||||
"Checksum fields zero but page is not empty.");
|
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -974,120 +965,130 @@ buf_page_is_corrupted(
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET);
|
|
||||||
|
|
||||||
const srv_checksum_algorithm_t curr_algo =
|
const srv_checksum_algorithm_t curr_algo =
|
||||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||||
|
|
||||||
switch (curr_algo) {
|
switch (curr_algo) {
|
||||||
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
|
return !buf_page_is_checksum_valid_crc32(
|
||||||
|
read_buf, checksum_field1, checksum_field2);
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
|
return !buf_page_is_checksum_valid_innodb(
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
read_buf, checksum_field1, checksum_field2);
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(true);
|
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
return !buf_page_is_checksum_valid_none(
|
||||||
|
read_buf, checksum_field1, checksum_field2);
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
|
/* Very old versions of InnoDB only stored 8 byte lsn to the
|
||||||
|
start and the end of the page. */
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_none(read_buf,
|
/* Since innodb_checksum_algorithm is not strict_* allow
|
||||||
checksum_field1, checksum_field2)) {
|
any of the algos to match for the old field */
|
||||||
return(false);
|
|
||||||
|
if (checksum_field2
|
||||||
|
!= mach_read_from_4(read_buf + FIL_PAGE_LSN)
|
||||||
|
&& checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
|
||||||
|
|
||||||
|
/* The checksum does not match any of the
|
||||||
|
fast to check. First check the selected algorithm
|
||||||
|
for writing checksums because we assume that the
|
||||||
|
chance of it matching is higher. */
|
||||||
|
|
||||||
|
if (srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_CRC32) {
|
||||||
|
|
||||||
|
crc32 = buf_calc_page_crc32(read_buf);
|
||||||
|
crc32_inited = true;
|
||||||
|
|
||||||
|
if (checksum_field2 != crc32
|
||||||
|
&& checksum_field2
|
||||||
|
!= buf_calc_page_old_checksum(read_buf)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ut_ad(srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_INNODB);
|
||||||
|
|
||||||
|
if (checksum_field2
|
||||||
|
!= buf_calc_page_old_checksum(read_buf)) {
|
||||||
|
|
||||||
|
crc32 = buf_calc_page_crc32(read_buf);
|
||||||
|
crc32_inited = true;
|
||||||
|
|
||||||
|
if (checksum_field2 != crc32) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
/* old field is fine, check the new field */
|
||||||
checksum_field1, checksum_field2)) {
|
|
||||||
page_warn_strict_checksum(
|
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
|
||||||
curr_algo,
|
(always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
space_id, page_no);
|
if (checksum_field1 != 0
|
||||||
return(false);
|
&& checksum_field1 != BUF_NO_CHECKSUM_MAGIC) {
|
||||||
|
|
||||||
|
/* The checksum does not match any of the
|
||||||
|
fast to check. First check the selected algorithm
|
||||||
|
for writing checksums because we assume that the
|
||||||
|
chance of it matching is higher. */
|
||||||
|
|
||||||
|
if (srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_CRC32) {
|
||||||
|
|
||||||
|
if (!crc32_inited) {
|
||||||
|
crc32 = buf_calc_page_crc32(read_buf);
|
||||||
|
crc32_inited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksum_field1 != crc32
|
||||||
|
&& checksum_field1
|
||||||
|
!= buf_calc_page_new_checksum(read_buf)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ut_ad(srv_checksum_algorithm
|
||||||
|
== SRV_CHECKSUM_ALGORITHM_INNODB);
|
||||||
|
|
||||||
|
if (checksum_field1
|
||||||
|
!= buf_calc_page_new_checksum(read_buf)) {
|
||||||
|
|
||||||
|
if (!crc32_inited) {
|
||||||
|
crc32 = buf_calc_page_crc32(
|
||||||
|
read_buf);
|
||||||
|
crc32_inited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checksum_field1 != crc32) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
/* If CRC32 is stored in at least one of the fields then the
|
||||||
checksum_field1, checksum_field2)) {
|
other field must also be CRC32 */
|
||||||
page_warn_strict_checksum(
|
if (crc32_inited
|
||||||
curr_algo,
|
&& ((checksum_field1 == crc32
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
&& checksum_field2 != crc32)
|
||||||
space_id, page_no);
|
|| (checksum_field1 != crc32
|
||||||
return(false);
|
&& checksum_field2 == crc32))) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
break;
|
||||||
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_NONE:
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
/* should have returned FALSE earlier */
|
/* should have returned FALSE earlier */
|
||||||
break;
|
ut_error;
|
||||||
/* no default so the compiler will emit a warning if new enum
|
/* no default so the compiler will emit a warning if new enum
|
||||||
is added and not handled here */
|
is added and not handled here */
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_error;
|
return false;
|
||||||
return(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Dump a page to stderr.
|
/** Dump a page to stderr.
|
||||||
|
@ -2669,7 +2669,7 @@ fil_space_verify_crypt_checksum(
|
|||||||
uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
|
uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
|
||||||
uint32_t checksum2;
|
uint32_t checksum2;
|
||||||
|
|
||||||
bool valid;
|
bool valid = false;
|
||||||
|
|
||||||
if (zip_size) {
|
if (zip_size) {
|
||||||
valid = (checksum1 == cchecksum1);
|
valid = (checksum1 == cchecksum1);
|
||||||
@ -2677,8 +2677,29 @@ fil_space_verify_crypt_checksum(
|
|||||||
} else {
|
} else {
|
||||||
checksum2 = mach_read_from_4(
|
checksum2 = mach_read_from_4(
|
||||||
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||||
valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2)
|
switch (algorithm) {
|
||||||
|| buf_page_is_checksum_valid_innodb(page,checksum1, checksum2));
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
|
valid = buf_page_is_checksum_valid_crc32(page, checksum1,
|
||||||
|
checksum2);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
|
valid = buf_page_is_checksum_valid_innodb(page, checksum1,
|
||||||
|
checksum2);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
valid = buf_page_is_checksum_valid_none(page, checksum1,
|
||||||
|
checksum2);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
|
valid = buf_page_is_checksum_valid_crc32(
|
||||||
|
page, checksum1, checksum2)
|
||||||
|
|| buf_page_is_checksum_valid_innodb(
|
||||||
|
page, checksum1, checksum2);
|
||||||
|
break;
|
||||||
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
|
ut_error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encrypted && valid) {
|
if (encrypted && valid) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
|
Copyright (c) 2013, 2018, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
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 the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -1109,23 +1110,6 @@ const rec_t*
|
|||||||
page_find_rec_max_not_deleted(
|
page_find_rec_max_not_deleted(
|
||||||
const page_t* page);
|
const page_t* page);
|
||||||
|
|
||||||
#endif /* #ifndef UNIV_INNOCHECKSUM */
|
|
||||||
|
|
||||||
/** Issue a warning when the checksum that is stored in the page is valid,
|
|
||||||
but different than the global setting innodb_checksum_algorithm.
|
|
||||||
@param[in] current_algo current checksum algorithm
|
|
||||||
@param[in] page_checksum page valid checksum
|
|
||||||
@param[in] space_id tablespace id
|
|
||||||
@param[in] page_no page number */
|
|
||||||
void
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
srv_checksum_algorithm_t curr_algo,
|
|
||||||
srv_checksum_algorithm_t page_checksum,
|
|
||||||
ulint space_id,
|
|
||||||
ulint page_no);
|
|
||||||
|
|
||||||
#ifndef UNIV_INNOCHECKSUM
|
|
||||||
|
|
||||||
#ifdef UNIV_MATERIALIZE
|
#ifdef UNIV_MATERIALIZE
|
||||||
#undef UNIV_INLINE
|
#undef UNIV_INLINE
|
||||||
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
|
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
|
||||||
|
@ -2822,49 +2822,3 @@ page_find_rec_max_not_deleted(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* #ifndef UNIV_INNOCHECKSUM */
|
#endif /* #ifndef UNIV_INNOCHECKSUM */
|
||||||
|
|
||||||
/** Issue a warning when the checksum that is stored in the page is valid,
|
|
||||||
but different than the global setting innodb_checksum_algorithm.
|
|
||||||
@param[in] current_algo current checksum algorithm
|
|
||||||
@param[in] page_checksum page valid checksum
|
|
||||||
@param[in] space_id tablespace id
|
|
||||||
@param[in] page_no page number */
|
|
||||||
void
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
srv_checksum_algorithm_t curr_algo,
|
|
||||||
srv_checksum_algorithm_t page_checksum,
|
|
||||||
ulint space_id,
|
|
||||||
ulint page_no)
|
|
||||||
{
|
|
||||||
srv_checksum_algorithm_t curr_algo_nonstrict = srv_checksum_algorithm_t();
|
|
||||||
switch (curr_algo) {
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32;
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_INNODB;
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
|
||||||
curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_NONE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef UNIV_INNOCHECKSUM
|
|
||||||
fprintf(stderr,
|
|
||||||
#else
|
|
||||||
ib_logf(IB_LOG_LEVEL_WARN,
|
|
||||||
#endif
|
|
||||||
"innodb_checksum_algorithm is set to \"%s\""
|
|
||||||
" but the page [page id: space=" ULINTPF ","
|
|
||||||
" page number=" ULINTPF "] contains a valid checksum \"%s\"."
|
|
||||||
" Accepting the page as valid. Change innodb_checksum_algorithm"
|
|
||||||
" to \"%s\" to silently accept such pages or rewrite all pages"
|
|
||||||
" so that they contain \"%s\" checksum.",
|
|
||||||
buf_checksum_algorithm_name(curr_algo),
|
|
||||||
space_id, page_no,
|
|
||||||
buf_checksum_algorithm_name(page_checksum),
|
|
||||||
buf_checksum_algorithm_name(curr_algo_nonstrict),
|
|
||||||
buf_checksum_algorithm_name(curr_algo_nonstrict));
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2012, Facebook Inc.
|
Copyright (c) 2012, Facebook Inc.
|
||||||
Copyright (c) 2014, 2017, MariaDB Corporation.
|
Copyright (c) 2014, 2018, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
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 the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -4930,10 +4930,6 @@ page_zip_verify_checksum(
|
|||||||
stored = static_cast<ib_uint32_t>(mach_read_from_4(
|
stored = static_cast<ib_uint32_t>(mach_read_from_4(
|
||||||
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
|
static_cast<const unsigned char*>(data) + FIL_PAGE_SPACE_OR_CHKSUM));
|
||||||
|
|
||||||
ulint page_no = mach_read_from_4(static_cast<const unsigned char*> (data) + FIL_PAGE_OFFSET);
|
|
||||||
ulint space_id = mach_read_from_4(static_cast<const unsigned char*>
|
|
||||||
(data) + FIL_PAGE_SPACE_ID);
|
|
||||||
|
|
||||||
#if FIL_PAGE_LSN % 8
|
#if FIL_PAGE_LSN % 8
|
||||||
#error "FIL_PAGE_LSN must be 64 bit aligned"
|
#error "FIL_PAGE_LSN must be 64 bit aligned"
|
||||||
#endif
|
#endif
|
||||||
@ -4944,8 +4940,7 @@ page_zip_verify_checksum(
|
|||||||
data)
|
data)
|
||||||
+ FIL_PAGE_LSN) == 0) {
|
+ FIL_PAGE_LSN) == 0) {
|
||||||
/* make sure that the page is really empty */
|
/* make sure that the page is really empty */
|
||||||
ulint i;
|
for (ulint i = 0; i < size; i++) {
|
||||||
for (i = 0; i < size; i++) {
|
|
||||||
if (*((const char*) data + i) != 0) {
|
if (*((const char*) data + i) != 0) {
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -4970,97 +4965,30 @@ page_zip_verify_checksum(
|
|||||||
|
|
||||||
switch (curr_algo) {
|
switch (curr_algo) {
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||||
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
|
||||||
|
|
||||||
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
|
|
||||||
|
|
||||||
if (stored == innodb) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||||
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
|
||||||
|
|
||||||
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
|
|
||||||
|
|
||||||
if (stored == crc32) {
|
|
||||||
if (curr_algo
|
|
||||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo,
|
|
||||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
space_id, page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||||
|
return stored == calc;
|
||||||
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
|
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
||||||
|
|
||||||
if (stored == crc32) {
|
|
||||||
page_warn_strict_checksum(
|
|
||||||
curr_algo, SRV_CHECKSUM_ALGORITHM_CRC32,
|
|
||||||
space_id, page_no);
|
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crc32 = calc;
|
||||||
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
innodb = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
||||||
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
|
data, size, SRV_CHECKSUM_ALGORITHM_INNODB));
|
||||||
|
break;
|
||||||
if (stored == innodb) {
|
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||||
page_warn_strict_checksum(
|
if (stored == BUF_NO_CHECKSUM_MAGIC) {
|
||||||
curr_algo,
|
return TRUE;
|
||||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
|
||||||
space_id, page_no);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crc32 = static_cast<ib_uint32_t>(page_zip_calc_checksum(
|
||||||
|
data, size, SRV_CHECKSUM_ALGORITHM_CRC32));
|
||||||
|
innodb = calc;
|
||||||
break;
|
break;
|
||||||
case SRV_CHECKSUM_ALGORITHM_NONE:
|
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||||
ut_error;
|
return TRUE;
|
||||||
/* no default so the compiler will emit a warning if new enum
|
|
||||||
is added and not handled here */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(FALSE);
|
return (stored == crc32 || stored == innodb);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user