summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqltest.cc42
-rwxr-xr-xdebian/additions/debian-start2
-rw-r--r--debian/mariadb-server-10.3.postinst8
-rw-r--r--extra/CMakeLists.txt3
-rw-r--r--extra/mariabackup/fil_cur.cc70
-rw-r--r--include/my_global.h2
-rw-r--r--mysql-test/main/alter_table.result21
-rw-r--r--mysql-test/main/alter_table.test19
-rw-r--r--mysql-test/main/connect.test7
-rw-r--r--mysql-test/main/cte_recursive.result38
-rw-r--r--mysql-test/main/cte_recursive.test34
-rw-r--r--mysql-test/main/partition.result100
-rw-r--r--mysql-test/main/partition.test62
-rw-r--r--mysql-test/main/selectivity_innodb.result1
-rw-r--r--mysql-test/main/stat_tables.result19
-rw-r--r--mysql-test/main/stat_tables.test17
-rw-r--r--mysql-test/main/stat_tables_innodb.result19
-rw-r--r--mysql-test/main/statistics.result10
-rw-r--r--mysql-test/suite/encryption/disabled.def1
-rw-r--r--mysql-test/suite/encryption/r/innodb-checksum-algorithm.result225
-rw-r--r--mysql-test/suite/encryption/t/innodb-checksum-algorithm.test9
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/data_types.result13
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff11
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_create.result22
-rw-r--r--mysql-test/suite/innodb/r/innochecksum.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result27
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum.result91
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result160
-rw-r--r--mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result227
-rw-r--r--mysql-test/suite/innodb/r/truncate.result21
-rw-r--r--mysql-test/suite/innodb/t/data_types.test13
-rw-r--r--mysql-test/suite/innodb/t/default_row_format_create.test20
-rw-r--r--mysql-test/suite/innodb/t/innochecksum.test32
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test25
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum.test239
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test118
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test406
-rw-r--r--mysql-test/suite/innodb/t/truncate.test21
-rw-r--r--mysql-test/suite/innodb_fts/r/create.result16
-rw-r--r--mysql-test/suite/innodb_fts/t/create.test16
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum.test4
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.opt6
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.result8
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.test51
-rw-r--r--mysql-test/suite/perfschema/r/socket_connect.result13
-rw-r--r--mysql-test/suite/perfschema/t/socket_connect.test9
-rw-r--r--mysql-test/suite/roles/flush_roles-17898.result13
-rw-r--r--mysql-test/suite/roles/flush_roles-17898.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test2
-rw-r--r--scripts/mytop.sh19
-rw-r--r--sql/item.cc3
-rw-r--r--sql/opt_range.cc17
-rw-r--r--sql/partition_info.cc17
-rw-r--r--sql/partition_info.h1
-rw-r--r--sql/sql_acl.cc127
-rw-r--r--sql/sql_array.h10
-rw-r--r--sql/sql_class.cc5
-rw-r--r--sql/sql_handler.cc2
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_statistics.cc43
-rw-r--r--sql/sql_statistics.h1
-rw-r--r--sql/sql_table.cc12
-rw-r--r--sql/structs.h2
-rw-r--r--storage/innobase/CMakeLists.txt6
-rw-r--r--storage/innobase/btr/btr0cur.cc19
-rw-r--r--storage/innobase/buf/buf0buf.cc363
-rw-r--r--storage/innobase/buf/buf0checksum.cc80
-rw-r--r--storage/innobase/fil/fil0crypt.cc39
-rw-r--r--storage/innobase/fts/fts0fts.cc8
-rw-r--r--storage/innobase/handler/ha_innodb.cc90
-rw-r--r--storage/innobase/handler/ha_innodb.h13
-rw-r--r--storage/innobase/handler/handler0alter.cc16
-rw-r--r--storage/innobase/include/buf0buf.h4
-rw-r--r--storage/innobase/include/buf0checksum.h30
-rw-r--r--storage/innobase/include/dict0dict.ic17
-rw-r--r--storage/innobase/include/fts0types.ic26
-rw-r--r--storage/innobase/include/page0page.h11
-rw-r--r--storage/innobase/include/page0zip.h11
-rw-r--r--storage/innobase/include/row0mysql.h4
-rw-r--r--storage/innobase/include/ut0crc32.h6
-rw-r--r--storage/innobase/innodb.cmake7
-rw-r--r--storage/innobase/page/page0page.cc39
-rw-r--r--storage/innobase/page/page0zip.cc224
-rw-r--r--storage/innobase/row/row0ftsort.cc16
-rw-r--r--storage/innobase/row/row0mysql.cc9
-rw-r--r--storage/innobase/ut/ut0crc32.cc14
-rw-r--r--tests/mysql_client_test.c62
91 files changed, 1385 insertions, 2308 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 79356108915..47e92eba7f8 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6612,8 +6612,6 @@ static inline bool is_escape_char(char c, char in_string)
SYNOPSIS
read_line
- buf buffer for the read line
- size size of the buffer i.e max size to read
DESCRIPTION
This function actually reads several lines and adds them to the
@@ -6631,10 +6629,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 *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;
my_bool have_slash= FALSE;
@@ -6642,10 +6645,21 @@ int read_line(char *buf, int size)
R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line");
+ *p= 0;
start_lineno= cur_file->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;
c= my_getc(cur_file->file);
if (feof(cur_file->file))
@@ -6681,7 +6695,7 @@ int read_line(char *buf, int size)
cur_file->lineno++;
/* Convert cr/lf to lf */
- if (p != buf && *(p-1) == '\r')
+ if (p != read_command_buf && *(p-1) == '\r')
p--;
}
@@ -6696,9 +6710,9 @@ int read_line(char *buf, int size)
}
else if ((c == '{' &&
(!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,
- (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 { */
*p++= c;
@@ -6830,8 +6844,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);
}
@@ -6976,12 +6988,8 @@ bool is_delimiter(const char* p)
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)
{
- char *p= read_command_buf;
struct st_command* command;
DBUG_ENTER("read_command");
@@ -6998,8 +7006,7 @@ int read_command(struct st_command** command_ptr)
die("Out of memory");
command->type= Q_UNKNOWN;
- read_command_buf[0]= 0;
- if (read_line(read_command_buf, sizeof(read_command_buf)))
+ if (read_line())
{
check_eol_junk(read_command_buf);
DBUG_RETURN(1);
@@ -7008,6 +7015,7 @@ int read_command(struct st_command** command_ptr)
if (opt_result_format_version == 1)
convert_to_format_v1(read_command_buf);
+ char *p= read_command_buf;
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
if (*p == '#')
{
@@ -9239,6 +9247,8 @@ int main(int argc, char **argv)
init_win_path_patterns();
#endif
+ read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
+
init_dynamic_string(&ds_res, "", 2048, 2048);
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
diff --git a/debian/additions/debian-start b/debian/additions/debian-start
index 40c248fd81f..7940bbe68a5 100755
--- a/debian/additions/debian-start
+++ b/debian/additions/debian-start
@@ -15,7 +15,7 @@ fi
MYSQL="/usr/bin/mysql --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_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
MYCHECK_PARAMS="--all-databases --fast --silent"
diff --git a/debian/mariadb-server-10.3.postinst b/debian/mariadb-server-10.3.postinst
index dbe664f30fb..7874a691268 100644
--- a/debian/mariadb-server-10.3.postinst
+++ b/debian/mariadb-server-10.3.postinst
@@ -2,13 +2,16 @@
. /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
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
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.
-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
# the install, rather than failing silently and leaving a broken install.
set -o pipefail
@@ -147,6 +150,9 @@ EOF
set -e
+ # To avoid downgrades.
+ touch $mysql_statedir/debian-$VER.flag
+
## On every reconfiguration the maintenance user is recreated.
#
# - It is easier to regenerate the password every time but as people
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index cd099dedf63..05b89290a6d 100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -72,6 +72,9 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
# We use the InnoDB code directly in case the code changes.
ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM")
+ IF(WITH_INNODB_BUG_ENDIAN_CRC32)
+ ADD_DEFINITIONS(-DINNODB_BUG_ENDIAN_CRC32)
+ ENDIF()
# Avoid generating Hardware Capabilities due to crc32 instructions
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index d37c8e2f752..258317bec05 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <trx0sys.h>
#include "fil_cur.h"
+#include "fil0crypt.h"
#include "common.h"
#include "read_filt.h"
#include "xtrabackup.h"
@@ -230,7 +231,7 @@ xb_fil_cur_open(
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
- const page_size_t page_size(cursor->node->space->flags);
+ const page_size_t page_size(node->space->flags);
cursor->page_size = page_size;
/* Allocate read buffer */
@@ -246,6 +247,19 @@ xb_fil_cur_open(
cursor->buf_page_no = 0;
cursor->thread_n = thread_n;
+ if (!node->space->crypt_data
+ && os_file_read(IORequestRead,
+ node->handle, cursor->buf, 0,
+ page_size.physical())) {
+ mutex_enter(&fil_system.mutex);
+ if (!node->space->crypt_data) {
+ node->space->crypt_data
+ = fil_space_read_crypt_data(page_size,
+ cursor->buf);
+ }
+ mutex_exit(&fil_system.mutex);
+ }
+
cursor->space_size = (ulint)(cursor->statinfo.st_size
/ page_size.physical());
@@ -267,7 +281,6 @@ xb_fil_cur_read(
/*============*/
xb_fil_cur_t* cursor) /*!< in/out: source file cursor */
{
- ibool success;
byte* page;
ulint i;
ulint npages;
@@ -275,6 +288,8 @@ xb_fil_cur_read(
xb_fil_cur_result_t ret;
ib_int64_t offset;
ib_int64_t to_read;
+ byte tmp_frame[UNIV_PAGE_SIZE_MAX];
+ byte tmp_page[UNIV_PAGE_SIZE_MAX];
const ulint page_size = cursor->page_size.physical();
xb_ad(!cursor->is_system() || page_size == srv_page_size);
@@ -317,6 +332,12 @@ xb_fil_cur_read(
retry_count = 10;
ret = XB_FIL_CUR_SUCCESS;
+ fil_space_t *space = fil_space_acquire_for_io(cursor->space_id);
+
+ if (!space) {
+ return XB_FIL_CUR_ERROR;
+ }
+
read_retry:
xtrabackup_io_throttling();
@@ -325,19 +346,11 @@ read_retry:
cursor->buf_offset = offset;
cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical());
- fil_space_t* space = fil_space_get(cursor->space_id);
-
- if (!space) {
- return(XB_FIL_CUR_ERROR);
- }
-
- success = os_file_read(IORequestRead,
- cursor->file, cursor->buf, offset,
- (ulint) to_read);
- if (!success) {
- return(XB_FIL_CUR_ERROR);
+ if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
+ (ulint) to_read)) {
+ ret = XB_FIL_CUR_ERROR;
+ goto func_exit;
}
-
/* check pages for corruption and re-read if necessary. i.e. in case of
partially written pages */
for (page = cursor->buf, i = 0; i < npages;
@@ -348,11 +361,26 @@ read_retry:
page_no >= FSP_EXTENT_SIZE &&
page_no < FSP_EXTENT_SIZE * 3) {
/* We ignore the doublewrite buffer pages */
- } else if (!fil_space_verify_crypt_checksum(
- page, cursor->page_size, space->id, page_no)
- && buf_page_is_corrupted(true, page,
- cursor->page_size,
- space)) {
+ } else if (fil_space_verify_crypt_checksum(
+ page, cursor->page_size,
+ space->id, page_no)) {
+ ut_ad(mach_read_from_4(page + FIL_PAGE_SPACE_ID)
+ == space->id);
+
+ bool decrypted = false;
+
+ memcpy(tmp_page, page, page_size);
+
+ if (!fil_space_decrypt(space, tmp_frame,
+ tmp_page, &decrypted)
+ || buf_page_is_corrupted(true, tmp_page,
+ cursor->page_size,
+ space)) {
+ goto corrupted;
+ }
+ } else if (buf_page_is_corrupted(true, page, cursor->page_size,
+ space)) {
+corrupted:
retry_count--;
if (retry_count == 0) {
msg("[%02u] mariabackup: "
@@ -372,7 +400,6 @@ read_retry:
}
os_thread_sleep(100000);
-
goto read_retry;
}
cursor->buf_read += page_size;
@@ -380,7 +407,8 @@ read_retry:
}
posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED);
-
+func_exit:
+ space->release_for_io();
return(ret);
}
diff --git a/include/my_global.h b/include/my_global.h
index 2922b74192a..37f78eabb4f 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1073,7 +1073,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */
static inline char *dlerror(void)
{
static char win_errormsg[2048];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
0, GetLastError(), 0, win_errormsg, 2048, NULL);
return win_errormsg;
}
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 49c42479516..8e54e882979 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -2469,3 +2469,24 @@ DROP TABLE t1;
#
# End of 10.2 tests
#
+#
+# MDEV-17778: Alter table leads to a truncation warning with ANALYZE command
+#
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @@use_stat_tables=PREFERABLY;
+create table t1 (a int)engine=InnoDB;
+insert into t1 values (1),(1),(2),(3);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+alter table t1 change a b int;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index dfa8e2e148b..829f4013cb3 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -2021,3 +2021,22 @@ DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # MDEV-17778: Alter table leads to a truncation warning with ANALYZE command
+--echo #
+
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @@use_stat_tables=PREFERABLY;
+
+create table t1 (a int)engine=InnoDB;
+insert into t1 values (1),(1),(2),(3);
+
+analyze table t1;
+alter table t1 change a b int;
+analyze table t1;
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+drop table t1;
diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test
index c2d44c08e22..3a38ad88462 100644
--- a/mysql-test/main/connect.test
+++ b/mysql-test/main/connect.test
@@ -253,11 +253,8 @@ let $wait_condition =
--echo
--echo # -- Waiting for connections to close...
-let $wait_condition =
- SELECT COUNT(*) = 1
- FROM information_schema.processlist
- WHERE db = 'test';
---source include/wait_condition.inc
+let $count_sessions=1;
+--source include/wait_until_count_sessions.inc
--echo
DROP USER mysqltest_u1@localhost;
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index 0417cf0a7f0..f2ae9929145 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -1608,6 +1608,44 @@ id name dob father mother
8 Grandpa Ben 1940-10-21 NULL NULL
6 Grandgrandma Martha 1923-05-17 NULL NULL
drop table my_ancestors;
+WITH RECURSIVE
+positions(i) AS (
+VALUES(0)
+UNION SELECT ALL
+i+1 FROM positions WHERE i < 4*4-1
+),
+solutions(board, n_queens) AS (
+SELECT REPEAT('-', 4*4), 0
+FROM positions
+UNION
+SELECT
+concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens
+FROM positions AS ps, solutions
+WHERE n_queens < 4
+AND substr(board,1,i) != '*'
+ AND NOT EXISTS (
+SELECT 1 FROM positions WHERE
+substr(board,i+1,1) = '*' AND
+(
+i % 4 = ps.i % 4 OR
+i div 4 = ps.i div 4 OR
+i div 4 + (i % 4) = ps.i div 4 + (ps.i % 4) OR
+i div 4 - (i % 4) = ps.i div 4 - (ps.i % 4)
+)
+)
+)
+SELECT regexp_replace(board,concat('(',REPEAT('.', 4),')'),'\\1\n') n_queens FROM solutions WHERE n_queens = 4;
+n_queens
+-*--
+---*
+*---
+--*-
+
+--*-
+*---
+---*
+-*--
+
#
# MDEV-10883: execution of prepared statement from SELECT
# with recursive CTE that renames columns
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 0ed9c2d56e3..483e1ea8c7a 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -1200,6 +1200,40 @@ select * from my_ancestors;
drop table my_ancestors;
+#
+# MDEV-17967 Add a solution of the 8 queens problem to the regression test for CTE
+#
+# adapted to MariaDB from https://rosettacode.org/wiki/N-queens_problem#SQL
+#
+let $N=4; # 8 takes too long for a test
+eval WITH RECURSIVE
+ positions(i) AS (
+ VALUES(0)
+ UNION SELECT ALL
+ i+1 FROM positions WHERE i < $N*$N-1
+ ),
+ solutions(board, n_queens) AS (
+ SELECT REPEAT('-', $N*$N), 0
+ FROM positions
+ UNION
+ SELECT
+ concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens
+ FROM positions AS ps, solutions
+ WHERE n_queens < $N
+ AND substr(board,1,i) != '*'
+ AND NOT EXISTS (
+ SELECT 1 FROM positions WHERE
+ substr(board,i+1,1) = '*' AND
+ (
+ i % $N = ps.i % $N OR
+ i div $N = ps.i div $N OR
+ i div $N + (i % $N) = ps.i div $N + (ps.i % $N) OR
+ i div $N - (i % $N) = ps.i div $N - (ps.i % $N)
+ )
+ )
+ )
+SELECT regexp_replace(board,concat('(',REPEAT('.', $N),')'),'\\\\1\\n') n_queens FROM solutions WHERE n_queens = $N;
+
--echo #
--echo # MDEV-10883: execution of prepared statement from SELECT
--echo # with recursive CTE that renames columns
diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result
index fd76da09d78..bf5d45846a5 100644
--- a/mysql-test/main/partition.result
+++ b/mysql-test/main/partition.result
@@ -2649,6 +2649,106 @@ Note 1517 Duplicate partition name p2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
#
+# MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+create table t2 (
+part_key int,
+a int,
+b int
+) partition by list(part_key) (
+partition p0 values in (0),
+partition p1 values in (1),
+partition p2 values in (2),
+partition p3 values in (3),
+partition p4 values in (4)
+);
+insert into t2
+select mod(a,5), a/100, mod(a,5) from t1;
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+#
+# Tests using stats provided by the storage engine
+#
+explain extended select * from t2 where part_key=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1
+explain partitions select * from t2 where part_key=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where
+explain extended select * from t2 where part_key in (1,2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2)
+explain partitions select * from t2 where part_key in (1,2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where
+explain extended select * from t2 where b=5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5
+explain partitions select * from t2 where b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where
+explain extended select * from t2 partition(p0) where b=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1
+set @save_histogram_size=@@histogram_size;
+set @@histogram_size=100;
+set @@use_stat_tables= PREFERABLY;
+set @@optimizer_use_condition_selectivity=4;
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+#
+# Tests using EITS
+#
+# filtered should be 100
+explain extended select * from t2 where part_key=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1
+explain partitions select * from t2 where part_key=1;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where
+# filtered should be 100
+explain extended select * from t2 where part_key in (1,2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2)
+explain partitions select * from t2 where part_key in (1,2);
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where
+explain extended select * from t2 where b=5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 19.80 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5
+explain partitions select * from t2 where b=5;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where
+explain extended select * from t2 partition(p0) where b=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 200 19.80 Using where
+Warnings:
+Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set @@histogram_size= @save_histogram_size;
+drop table t0,t1,t2;
+#
# End of 10.0 tests
#
#
diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test
index 7b7d1457426..42929796f6b 100644
--- a/mysql-test/main/partition.test
+++ b/mysql-test/main/partition.test
@@ -2901,6 +2901,68 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo #
+--echo # MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
+--echo #
+
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1(a int);
+insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
+
+
+create table t2 (
+ part_key int,
+ a int,
+ b int
+) partition by list(part_key) (
+ partition p0 values in (0),
+ partition p1 values in (1),
+ partition p2 values in (2),
+ partition p3 values in (3),
+ partition p4 values in (4)
+);
+insert into t2
+select mod(a,5), a/100, mod(a,5) from t1;
+
+set @save_use_stat_tables= @@use_stat_tables;
+set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
+--echo #
+--echo # Tests using stats provided by the storage engine
+--echo #
+explain extended select * from t2 where part_key=1;
+explain partitions select * from t2 where part_key=1;
+explain extended select * from t2 where part_key in (1,2);
+explain partitions select * from t2 where part_key in (1,2);
+explain extended select * from t2 where b=5;
+explain partitions select * from t2 where b=5;
+explain extended select * from t2 partition(p0) where b=1;
+
+
+set @save_histogram_size=@@histogram_size;
+set @@histogram_size=100;
+set @@use_stat_tables= PREFERABLY;
+set @@optimizer_use_condition_selectivity=4;
+analyze table t2;
+--echo #
+--echo # Tests using EITS
+--echo #
+--echo # filtered should be 100
+explain extended select * from t2 where part_key=1;
+explain partitions select * from t2 where part_key=1;
+--echo # filtered should be 100
+explain extended select * from t2 where part_key in (1,2);
+explain partitions select * from t2 where part_key in (1,2);
+explain extended select * from t2 where b=5;
+explain partitions select * from t2 where b=5;
+explain extended select * from t2 partition(p0) where b=1;
+
+set @@use_stat_tables= @save_use_stat_tables;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set @@histogram_size= @save_histogram_size;
+drop table t0,t1,t2;
+
+--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result
index 921bd20fc69..93917065722 100644
--- a/mysql-test/main/selectivity_innodb.result
+++ b/mysql-test/main/selectivity_innodb.result
@@ -1150,7 +1150,6 @@ alter table t1 change column a a int;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
-test.t1 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t1 analyze status OK
flush table t1;
explain extended select * from t1 where a between 5 and 7;
diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result
index 40290ca9879..3ebc3b47833 100644
--- a/mysql-test/main/stat_tables.result
+++ b/mysql-test/main/stat_tables.result
@@ -591,6 +591,25 @@ id select_type table type possible_keys key key_len ref rows Extra
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
#
+# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+#
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from t1 where a=1 and b=3;
+a b
+1 3
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+#
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
#
SET use_stat_tables= PREFERABLY;
diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test
index 85a10987300..b89ab2bbd2d 100644
--- a/mysql-test/main/stat_tables.test
+++ b/mysql-test/main/stat_tables.test
@@ -370,6 +370,23 @@ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectiv
set use_stat_tables=@save_use_stat_tables;
--echo #
+--echo # MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+--echo #
+
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+
+analyze table t1 persistent for columns (a) indexes ();
+select * from t1 where a=1 and b=3;
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+
+--echo #
--echo # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
--echo #
diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result
index 070d13d9bb1..a6c5525a0d3 100644
--- a/mysql-test/main/stat_tables_innodb.result
+++ b/mysql-test/main/stat_tables_innodb.result
@@ -618,6 +618,25 @@ id select_type table type possible_keys key key_len ref rows Extra
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
#
+# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes
+#
+set @@use_stat_tables= PREFERABLY;
+set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
+set @@optimizer_use_condition_selectivity=4;
+set @save_use_stat_tables= @@use_stat_tables;
+create table t1 (a int, b int);
+insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10);
+analyze table t1 persistent for columns (a) indexes ();
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+select * from t1 where a=1 and b=3;
+a b
+1 3
+set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
+drop table t1;
+#
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
#
SET use_stat_tables= PREFERABLY;
diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result
index 574eb5f4727..34a17cf049c 100644
--- a/mysql-test/main/statistics.result
+++ b/mysql-test/main/statistics.result
@@ -1086,9 +1086,6 @@ test t2 idx4 3 1.1304
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1149,11 +1146,6 @@ test t2 idx4 4 1.0000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_length' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
@@ -1179,8 +1171,6 @@ test t2 idx3 1 8.5000
ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
-test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1
test.t2 analyze status OK
SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
db_name table_name index_name prefix_arity avg_frequency
diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def
index d92d3495cb8..746faf49873 100644
--- a/mysql-test/suite/encryption/disabled.def
+++ b/mysql-test/suite/encryption/disabled.def
@@ -12,3 +12,4 @@
innodb_scrub : MDEV-8139 scrubbing does not work reliably
innodb_scrub_background : MDEV-8139 scrubbing does not work reliably
+innodb-redo-badkey : MDEV-13893/MDEV-12699 fix recovery of corrupted pages
diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
index cca3b9ad686..afb79dbad8a 100644
--- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
+++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
@@ -58,31 +58,6 @@ tpe_crc32.cfg
tpe_crc32.frm
tpe_crc32.ibd
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;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -108,31 +83,6 @@ 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=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;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -158,31 +108,6 @@ 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=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;
ALTER TABLE tce_crc32 DISCARD TABLESPACE;
ALTER TABLE tc_crc32 DISCARD TABLESPACE;
@@ -268,31 +193,6 @@ tpe_innodb.cfg
tpe_innodb.frm
tpe_innodb.ibd
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;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -318,31 +218,6 @@ 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=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;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -368,31 +243,6 @@ 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=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;
ALTER TABLE tce_innodb DISCARD TABLESPACE;
ALTER TABLE tc_innodb DISCARD TABLESPACE;
@@ -478,31 +328,6 @@ tpe_none.cfg
tpe_none.frm
tpe_none.ibd
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;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
@@ -528,31 +353,6 @@ 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=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;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
@@ -578,31 +378,6 @@ 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=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;
ALTER TABLE tce_none DISCARD TABLESPACE;
ALTER TABLE tc_none DISCARD TABLESPACE;
diff --git a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
index 7eaa1bd64c6..c9a4a9e1b92 100644
--- a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
+++ b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
@@ -65,17 +65,14 @@ EOF
--list_files $MYSQLD_DATADIR/test
UNLOCK TABLES;
-let $to = 6;
+let $to = 3;
while ($to)
{
dec $to;
let $tocksum = `select case $to
when 0 then 'none'
- when 1 then 'strict_none'
- when 2 then 'innodb'
- when 3 then 'strict_innodb'
- when 4 then 'crc32'
- when 5 then 'strict_crc32'
+ when 1 then 'innodb'
+ when 2 then 'crc32'
end`;
eval SET GLOBAL innodb_checksum_algorithm=$tocksum;
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index 577b3255620..de88b745292 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -696,8 +696,6 @@ Warning 1264 Out of range value for column 'b' at row 1
SELECT * FROM t WHERE c = '0';
a b c
1 127 0
-Warnings:
-Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t;
#
# Bug#21688115 VIRTUAL COLUMN COMPUTATION SAVE_IN_FIELD()
diff --git a/mysql-test/suite/innodb/r/data_types.result b/mysql-test/suite/innodb/r/data_types.result
index 446d37527e5..4e919e37cee 100644
--- a/mysql-test/suite/innodb/r/data_types.result
+++ b/mysql-test/suite/innodb/r/data_types.result
@@ -75,10 +75,13 @@ t1_VARCHAR_10_BINARY VARCHAR(10) BINARY,
t1_VARCHAR_500 VARCHAR(500),
t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
t1_YEAR_2 YEAR(2),
-t1_YEAR_4 YEAR(4)
+t1_YEAR_4 YEAR(4),
+t1_CHAR_0 CHAR(0),
+t1_MYSQL_0 CHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB;
Warnings:
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
+INSERT INTO t1 () VALUES ();
SELECT
name,
CASE mtype
@@ -109,6 +112,7 @@ t1_BINARY_100 DATA_FIXBINARY
t1_BIT_2 DATA_FIXBINARY UNSIGNED
t1_BIT_20 DATA_FIXBINARY UNSIGNED
t1_BLOB DATA_BLOB
+t1_CHAR_0 DATA_CHAR
t1_CHAR_100 DATA_CHAR
t1_CHAR_100_BINARY DATA_MYSQL
t1_DATE DATA_INT
@@ -131,6 +135,7 @@ t1_MEDIUMBLOB DATA_BLOB
t1_MEDIUMINT DATA_INT
t1_MEDIUMINT_UNSIGNED DATA_INT UNSIGNED
t1_MEDIUMTEXT DATA_BLOB
+t1_MYSQL_0 DATA_MYSQL
t1_SET DATA_INT UNSIGNED
t1_SET_9 DATA_INT UNSIGNED
t1_SET_BINARY DATA_INT UNSIGNED
@@ -153,3 +158,9 @@ t1_VARCHAR_500_BINARY DATA_VARMYSQL
t1_YEAR_2 DATA_INT UNSIGNED
t1_YEAR_4 DATA_INT UNSIGNED
DROP TABLE t1;
+#
+# MDEV-17815 Assertion failed in btr_node_ptr_max_size for CHAR(0)
+#
+CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
index 5258b7193fa..fbf1d914f5b 100644
--- a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
+++ b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff
@@ -9,3 +9,14 @@
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SHOW TABLE STATUS LIKE 't1';
+@@ -31,8 +31,9 @@
+ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+-t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N
+ DROP TABLE IF EXISTS t1;
++Warnings:
++Note 1051 Unknown table 'test.t1'
+ SET @save_format = @@GLOBAL.innodb_default_row_format;
+ SET GLOBAL innodb_default_row_format = redundant;
+ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/default_row_format_create.result b/mysql-test/suite/innodb/r/default_row_format_create.result
index 83d04b47bd0..262e8bc7f19 100644
--- a/mysql-test/suite/innodb/r/default_row_format_create.result
+++ b/mysql-test/suite/innodb/r/default_row_format_create.result
@@ -19,8 +19,26 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT 0 N
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
-ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+ROW_FORMAT=COMPRESSED;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
-t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED key_block_size=1 0 N
+t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N
+TRUNCATE TABLE t1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED 0 N
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 0 N
+DROP TABLE IF EXISTS t1;
+SET @save_format = @@GLOBAL.innodb_default_row_format;
+SET GLOBAL innodb_default_row_format = redundant;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+SET GLOBAL innodb_default_row_format = @save_format;
+TRUNCATE TABLE t1;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
+t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innochecksum.result b/mysql-test/suite/innodb/r/innochecksum.result
deleted file mode 100644
index 2d8a2652309..00000000000
--- a/mysql-test/suite/innodb/r/innochecksum.result
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
-INSERT INTO t1 (b) VALUES ('corrupt me');
-INSERT INTO t1 (b) VALUES ('corrupt me');
-# Run innochecksum on t1
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index df27769b810..8d7dcb84486 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -1184,6 +1184,33 @@ t2c CREATE TABLE `t2c` (
KEY `t2a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1,t2,t2c,t2i;
+CREATE TABLE t1 (c VARCHAR(1024),
+c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL,
+c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL,
+c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL,
+ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL,
+cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL,
+d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL,
+d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL,
+d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL,
+d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL,
+dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL,
+UNIQUE KEY(c))
+ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''),
+(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=inplace;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=copy;
+ERROR HY000: Index column size too large. The maximum column size is 767 bytes
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
#
# Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
#
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
deleted file mode 100644
index 31d9450df80..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum.result
+++ /dev/null
@@ -1,91 +0,0 @@
-# Set the environmental variables
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
-CREATE INDEX idx1 ON tab1(c2(10));
-INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"i");
-insert into t1 values(2,"am");
-insert into t1 values(3,"compressed table");
-# Shutdown the Server
-# Server Default checksum = innodb
-[1b]: check the innochecksum without --strict-check
-[2]: check the innochecksum with full form --strict-check=crc32
-[3]: check the innochecksum with short form -C crc32
-[4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
-FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
-[5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
-FOUND 1 /Error: --no-check must be associated with --write option./ in my_restart.err
-[6]: check the innochecksum with full form strict-check & no-check , an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[7]: check the innochecksum with short form strict-check & no-check , an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[8]: check the innochecksum with short & full form combination
-# strict-check & no-check, an error is expected
-FOUND 1 /Error: --strict-check option cannot be used together with --no-check option./ in my_restart.err
-[9]: check the innochecksum with full form --strict-check=innodb
-[10]: check the innochecksum with full form --strict-check=none
-# when server Default checksum=crc32
-[11]: check the innochecksum with short form -C innodb
-# when server Default checksum=crc32
-[12]: check the innochecksum with short form -C none
-# when server Default checksum=crc32
-[13]: check strict-check with invalid values
-FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_innodb\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_crc32\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_none\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'InnoBD\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'crc\' to \'strict-check\'/ in my_restart.err
-FOUND 1 /Error while setting value \'no\' to \'strict-check\'/ in my_restart.err
-[14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
-# Also check the long form of write option.
-[14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
-# Also check the long form of write option.
-# start the server with innodb_checksum_algorithm=InnoDB
-INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-# Stop the server
-[15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
-# Also check the short form of write option.
-# Start the server with checksum algorithm=none
-INSERT INTO tab1 VALUES(3, 'Innochecksum None');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-3 Innochecksum None
-DROP TABLE t1;
-# Stop the server
-[16]: rewrite into new checksum=crc32 with innochecksum
-# Restart the DB server with innodb_checksum_algorithm=crc32
-SELECT * FROM tab1;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-3 Innochecksum None
-DELETE FROM tab1 where c1=3;
-SELECT c1,c2 FROM tab1 order by c1,c2;
-c1 c2
-1 Innochecksum InnoDB1
-2 Innochecksum CRC32
-# Stop server
-[17]: rewrite into new checksum=InnoDB
-# Restart the DB server with innodb_checksum_algorithm=InnoDB
-DELETE FROM tab1 where c1=2;
-SELECT * FROM tab1;
-c1 c2
-1 Innochecksum InnoDB1
-# Stop server
-[18]:check Innochecksum with invalid write options
-FOUND 1 /Error while setting value \'strict_crc32\' to \'write\'/ in my_restart.err
-FOUND 1 /Error while setting value \'strict_innodb\' to \'write\'/ in my_restart.err
-FOUND 1 /Error while setting value \'crc23\' to \'write\'/ in my_restart.err
-DROP TABLE tab1;
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
deleted file mode 100644
index 582bb42f0cb..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum2.result
+++ /dev/null
@@ -1,160 +0,0 @@
-SET GLOBAL innodb_compression_level=0;
-SELECT @@innodb_compression_level;
-@@innodb_compression_level
-0
-CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-INSERT INTO t1 SELECT * from t1;
-# stop the server
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose TRUE
-debug FALSE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[1]:# check the both short and long options for "help"
-[2]:# Run the innochecksum when file isn't provided.
-# It will print the innochecksum usage similar to --help option.
-innochecksum Ver #.#.#
-Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
-
-InnoDB offline file checksum utility.
-Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
- -?, --help Displays this help and exits.
- -I, --info Synonym for --help.
- -V, --version Displays version information and exits.
- -v, --verbose Verbose (prints progress every 5 seconds).
- -c, --count Print the count of pages in the file and exits.
- -s, --start-page=# Start on this page number (0 based).
- -e, --end-page=# End at this page number (0 based).
- -p, --page=# Check only this page (0 based).
- -C, --strict-check=name
- Specify the strict checksum algorithm by the user.. One
- of: crc32, crc32, innodb, innodb, none, none
- -n, --no-check Ignore the checksum verification.
- -a, --allow-mismatches=#
- Maximum checksum mismatch allowed.
- -w, --write=name Rewrite the checksum algorithm by the user.. One of:
- crc32, crc32, innodb, innodb, none, none
- -S, --page-type-summary
- Display a count of each page type in a tablespace.
- -D, --page-type-dump=name
- Dump the page type info for each page in a tablespace.
- -i, --per-page-details
- Print out per-page detail information.
- -l, --log=name log output.
- -f, --leaf Examine leaf index pages
- -m, --merge=# leaf page count if merge given number of consecutive
- pages
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose FALSE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump (No default value)
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[3]:# check the both short and long options for "count" and exit
-Number of pages:#
-Number of pages:#
-[4]:# Print the version of innochecksum and exit
-innochecksum Ver #.#.## Restart the DB server
-DROP TABLE t1;
-[5]:# Check the innochecksum for compressed table t1 with different key_block_size
-# Test for KEY_BLOCK_SIZE=1
-===> Testing size=1
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test for KEY_BLOCK_SIZE=2
-===> Testing size=2
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test for for KEY_BLOCK_SIZE=4
-===> Testing size=4
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-set innodb_strict_mode=off;
-# Test for for KEY_BLOCK_SIZE=8
-===> Testing size=8
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-set innodb_strict_mode=off;
-# Test for KEY_BLOCK_SIZE=16
-===> Testing size=16
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=16;
-insert into t1 values(1,"I");
-insert into t1 values(2,"AM");
-insert into t1 values(3,"COMPRESSED");
-select * from t1;
-id msg
-1 I
-2 AM
-3 COMPRESSED
-drop table t1;
-# Test[5] completed
diff --git a/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result b/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
deleted file mode 100644
index aaab68b3df9..00000000000
--- a/mysql-test/suite/innodb/r/innodb_zip_innochecksum3.result
+++ /dev/null
@@ -1,227 +0,0 @@
-# Set the environmental variables
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*");
-[1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
-CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
-linestring_key GEOMETRY NOT NULL,
-linestring_nokey GEOMETRY NOT NULL)
-ENGINE=InnoDB ;
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) '));
-CREATE INDEX linestring_index ON tab1(linestring_nokey(5));
-ALTER TABLE tab1 ADD KEY (linestring_key(5));
-# create a compressed table
-CREATE TABLE tab2(col_1 CHAR (255) ,
-col_2 VARCHAR (255), col_3 longtext,
-col_4 longtext,col_5 longtext,
-col_6 longtext , col_7 int )
-engine = innodb row_format=compressed key_block_size=4;
-CREATE INDEX idx1 ON tab2(col_3(10));
-CREATE INDEX idx2 ON tab2(col_4(10));
-CREATE INDEX idx3 ON tab2(col_5(10));
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,5);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,4);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,3);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,2);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,1);
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
-: start the server with innodb_checksum_algorithm=strict_innodb
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,6);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
-# start the server with innodb_checksum_algorithm=strict_crc32
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
-ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
-SET @col_1 = repeat('g', 5);
-SET @col_2 = repeat('h', 20);
-SET @col_3 = repeat('i', 100);
-SET @col_4 = repeat('j', 100);
-SET @col_5 = repeat('k', 100);
-SET @col_6 = repeat('l', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,7);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
-SET @col_1 = repeat('m', 5);
-SET @col_2 = repeat('n', 20);
-SET @col_3 = repeat('o', 100);
-SET @col_4 = repeat('p', 100);
-SET @col_5 = repeat('q', 100);
-SET @col_6 = repeat('r', 100);
-INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,8);
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-SELECT * FROM tab2 ORDER BY col_7;
-# stop the server
-[2]: Check the page type summary with shortform for tab1.ibd
-
-File::tab#.ibd
-================PAGE TYPE SUMMARY==============
-#PAGE_COUNT PAGE_TYPE
-===============================================
- # Index page
- # Undo log page
- # Inode page
- # Insert buffer free list page
- # Freshly allocated page
- # Insert buffer bitmap
- # System page
- # Transaction system page
- # File Space Header
- # Extent descriptor page
- # BLOB page
- # Compressed BLOB page
- # Page compressed page
- # Page compressed encrypted page
- # Other type of page
-
-===============================================
-Additional information:
-Undo page type: # insert, # update, # other
-Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
-index_id #pages #leaf_pages #recs_per_page #bytes_per_page
-# # # # #
-# # # # #
-# # # # #
-
-index_id page_data_bytes_histgram(empty,...,oversized)
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-[3]: Check the page type summary with longform for tab1.ibd
-
-File::tab#.ibd
-================PAGE TYPE SUMMARY==============
-#PAGE_COUNT PAGE_TYPE
-===============================================
- # Index page
- # Undo log page
- # Inode page
- # Insert buffer free list page
- # Freshly allocated page
- # Insert buffer bitmap
- # System page
- # Transaction system page
- # File Space Header
- # Extent descriptor page
- # BLOB page
- # Compressed BLOB page
- # Page compressed page
- # Page compressed encrypted page
- # Other type of page
-
-===============================================
-Additional information:
-Undo page type: # insert, # update, # other
-Undo page state: # active, # cached, # to_free, # to_purge, # prepared, # other
-index_id #pages #leaf_pages #recs_per_page #bytes_per_page
-# # # # #
-# # # # #
-# # # # #
-
-index_id page_data_bytes_histgram(empty,...,oversized)
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-# # # # # # # # # # # # #
-[4]: Page type dump for with longform for tab1.ibd
-# Print the contents stored in dump.txt
-
-
-Filename::tab#.ibd
-==============================================================================
- PAGE_NO | PAGE_TYPE | EXTRA INFO
-==============================================================================
-#::# | File Space Header | -
-#::# | Insert Buffer Bitmap | -
-#::# | Inode page | -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Freshly allocated page | -
-# Variables used by page type dump for ibdata1
-
-Variables (--variable-name=value)
-and boolean options {FALSE|TRUE} Value (after reading options)
---------------------------------- ----------------------------------------
-verbose TRUE
-count FALSE
-start-page 0
-end-page 0
-page 0
-strict-check crc32
-no-check FALSE
-allow-mismatches 0
-write crc32
-page-type-summary FALSE
-page-type-dump MYSQLTEST_VARDIR/tmp/dump.txt
-per-page-details FALSE
-log (No default value)
-leaf FALSE
-merge 0
-[5]: Page type dump for with shortform for tab1.ibd
-
-
-Filename::tab#.ibd
-==============================================================================
- PAGE_NO | PAGE_TYPE | EXTRA INFO
-==============================================================================
-#::# | File Space Header | -
-#::# | Insert Buffer Bitmap | -
-#::# | Inode page | -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
-#::# | Freshly allocated page | -
-[6]: check the valid lower bound values for option
-# allow-mismatches,page,start-page,end-page
-[9]: check the both short and long options "page" and "start-page" when
-# seek value is larger than file size.
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-FOUND 1 /Error: Unable to seek to necessary offset: Invalid argument/ in my_restart.err
-[34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
-# innochecksum will fail with error code: 1
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-NOT FOUND /Incorrect unsigned integer value: '18446744073709551616'/ in my_restart.err
-DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result
index f584ffadc05..0e5ffeea34f 100644
--- a/mysql-test/suite/innodb/r/truncate.result
+++ b/mysql-test/suite/innodb/r/truncate.result
@@ -7,18 +7,6 @@ TRUNCATE TABLE t;
disconnect dml;
DROP TABLE t;
#
-# MDEV-17816 Crash in TRUNCATE TABLE when table creation fails
-#
-CREATE TABLE t1 (c VARCHAR(1024), KEY(c)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 SET c='character';
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-TRUNCATE TABLE t1;
-ERROR HY000: Index column size too large. The maximum column size is 767 bytes
-SELECT * FROM t1;
-c
-character
-DROP TABLE t1;
-#
# MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
#
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
@@ -42,3 +30,12 @@ SELECT * FROM t1;
a
1
DROP TABLE t1;
+#
+# MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
+#
+CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+TRUNCATE t1;
+SELECT * FROM t1;
+a
+DROP TEMPORARY TABLE t1;
diff --git a/mysql-test/suite/innodb/t/data_types.test b/mysql-test/suite/innodb/t/data_types.test
index 0978146361c..c8e80c9db27 100644
--- a/mysql-test/suite/innodb/t/data_types.test
+++ b/mysql-test/suite/innodb/t/data_types.test
@@ -88,9 +88,13 @@ CREATE TABLE t1
t1_VARCHAR_500 VARCHAR(500),
t1_VARCHAR_500_BINARY VARCHAR(500) BINARY,
t1_YEAR_2 YEAR(2),
- t1_YEAR_4 YEAR(4)
+ t1_YEAR_4 YEAR(4),
+ t1_CHAR_0 CHAR(0),
+ t1_MYSQL_0 CHAR(0) CHARACTER SET utf8
) ENGINE=InnoDB;
+INSERT INTO t1 () VALUES ();
+
SELECT
name,
CASE mtype
@@ -116,3 +120,10 @@ WHERE name LIKE "t1\_%"
ORDER BY name;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17815 Assertion failed in btr_node_ptr_max_size for CHAR(0)
+--echo #
+CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/default_row_format_create.test b/mysql-test/suite/innodb/t/default_row_format_create.test
index e0981abf7eb..03a7ebd3752 100644
--- a/mysql-test/suite/innodb/t/default_row_format_create.test
+++ b/mysql-test/suite/innodb/t/default_row_format_create.test
@@ -22,7 +22,25 @@ SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
-ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+ROW_FORMAT=COMPRESSED;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+TRUNCATE TABLE t1;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+DROP TABLE t1;
+
+--error 0,ER_CANT_CREATE_TABLE
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1;
+--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
+SHOW TABLE STATUS LIKE 't1';
+DROP TABLE IF EXISTS t1;
+
+SET @save_format = @@GLOBAL.innodb_default_row_format;
+SET GLOBAL innodb_default_row_format = redundant;
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+SET GLOBAL innodb_default_row_format = @save_format;
+TRUNCATE TABLE t1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innochecksum.test b/mysql-test/suite/innodb/t/innochecksum.test
deleted file mode 100644
index 79896ed1e3f..00000000000
--- a/mysql-test/suite/innodb/t/innochecksum.test
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Test innochecksum
-#
-
---source include/have_innodb.inc
-# Embedded server test does not support restarting
---source include/not_embedded.inc
-
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
-INSERT INTO t1 (b) VALUES ('corrupt me');
---disable_query_log
---let $i = 1000
-while ($i)
-{
- INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100));
- dec $i;
-}
---enable_query_log
-INSERT INTO t1 (b) VALUES ('corrupt me');
-
-let $MYSQLD_DATADIR=`select @@datadir`;
-
---source include/shutdown_mysqld.inc
-
---echo # Run innochecksum on t1
---disable_result_log
---exec $INNOCHECKSUM $MYSQLD_DATADIR/test/t1.ibd
---enable_result_log
-
---source include/start_mysqld.inc
-
-DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index e575cff4774..f199da54031 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -549,6 +549,31 @@ show create table t2c;
--disable_info
DROP TABLE t1,t2,t2c,t2i;
+
+CREATE TABLE t1 (c VARCHAR(1024),
+c1 CHAR(255) NOT NULL,c2 CHAR(255) NOT NULL,c3 CHAR(255) NOT NULL,
+c4 CHAR(255) NOT NULL,c5 CHAR(255) NOT NULL,c6 CHAR(255) NOT NULL,
+c7 CHAR(255) NOT NULL,c8 CHAR(255) NOT NULL,c9 CHAR(255) NOT NULL,
+ca CHAR(255) NOT NULL,cb CHAR(255) NOT NULL,cc CHAR(255) NOT NULL,
+cd CHAR(255) NOT NULL,ce CHAR(255) NOT NULL,cf CHAR(255) NOT NULL,
+d0 CHAR(255) NOT NULL,d1 CHAR(255) NOT NULL,d2 CHAR(255) NOT NULL,
+d3 CHAR(255) NOT NULL,d4 CHAR(255) NOT NULL,d5 CHAR(255) NOT NULL,
+d6 CHAR(255) NOT NULL,d7 CHAR(255) NOT NULL,d8 CHAR(255) NOT NULL,
+d9 CHAR(255) NOT NULL,da CHAR(255) NOT NULL,db CHAR(255) NOT NULL,
+dc CHAR(255) NOT NULL,dd CHAR(255) NOT NULL,de CHAR(255) NOT NULL,
+UNIQUE KEY(c))
+ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(repeat('a',999),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''),
+(CONCAT(repeat('a',999),'b'),'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','');
+--error ER_INDEX_COLUMN_TOO_LONG
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=inplace;
+--error ER_INDEX_COLUMN_TOO_LONG
+ALTER TABLE t1 ROW_FORMAT=REDUNDANT, algorithm=copy;
+SELECT COUNT(*) FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1;
+
--echo #
--echo # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE
--echo #
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
deleted file mode 100644
index 1dcd1367b3a..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---skip-innodb-doublewrite
---innodb-file-per-table
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
deleted file mode 100644
index 63a4b418677..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum.test
+++ /dev/null
@@ -1,239 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
---source include/no_valgrind_without_big.inc
-# Embedded server does not support crashing.
---source include/not_embedded.inc
-
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---echo # Set the environmental variables
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
-
-CREATE TABLE tab1(c1 INT PRIMARY KEY,c2 VARCHAR(20)) ENGINE=InnoDB;
-CREATE INDEX idx1 ON tab1(c2(10));
-INSERT INTO tab1 VALUES(1, 'Innochecksum InnoDB1');
-CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
-insert into t1 values(1,"i");
-insert into t1 values(2,"am");
-insert into t1 values(3,"compressed table");
-
---echo # Shutdown the Server
---source include/shutdown_mysqld.inc
---echo # Server Default checksum = innodb
-
-#
-# Not repeatable with --parallel= >1
-#
-#--echo [1a]: check the innochecksum when file doesn't exists
-#--error 1
-#--exec $INNOCHECKSUM $MYSQLD_DATADIR/test/aa.ibd 2> $SEARCH_FILE
-#let SEARCH_PATTERN= Error: $MYSQLD_DATADIR/test/aa.ibd cannot be found;
-#--source include/search_pattern_in_file.inc
-
---echo [1b]: check the innochecksum without --strict-check
---exec $INNOCHECKSUM $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [2]: check the innochecksum with full form --strict-check=crc32
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [3]: check the innochecksum with short form -C crc32
---exec $INNOCHECKSUM -C crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [4]: check the innochecksum with --no-check ignores algorithm check, warning is expected
---error 1
---exec $INNOCHECKSUM --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
---source include/search_pattern_in_file.inc
-
---echo [5]: check the innochecksum with short form --no-check ignores algorithm check, warning is expected
---error 1
---exec $INNOCHECKSUM -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --no-check must be associated with --write option.;
---source include/search_pattern_in_file.inc
-
---echo [6]: check the innochecksum with full form strict-check & no-check , an error is expected
---error 1
---exec $INNOCHECKSUM --strict-check=innodb --no-check $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [7]: check the innochecksum with short form strict-check & no-check , an error is expected
---error 1
---exec $INNOCHECKSUM -C innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [8]: check the innochecksum with short & full form combination
---echo # strict-check & no-check, an error is expected
---error 1
---exec $INNOCHECKSUM --strict-check=innodb -n $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: --strict-check option cannot be used together with --no-check option.;
---source include/search_pattern_in_file.inc
-
---echo [9]: check the innochecksum with full form --strict-check=innodb
-# Server Default checksum = crc32
---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 # when server Default checksum=crc32
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [11]: check the innochecksum with short form -C innodb
---echo # when server Default checksum=crc32
---exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [12]: check the innochecksum with short form -C none
---echo # when server Default checksum=crc32
---exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-
---echo [13]: check strict-check with invalid values
---error 1
---exec $INNOCHECKSUM --strict-check=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_innodb\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_crc32\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C strict_none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'strict_none\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -C InnoBD $MYSQLD_DATADIR/test/tab1.ibd 2>$SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'InnoBD\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=crc $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'crc\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --strict-check=no $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error while setting value \'no\' to \'strict-check\';
---source include/search_pattern_in_file.inc
-
---echo [14a]: when server default checksum=crc32 rewrite new checksum=crc32 with innochecksum
---echo # Also check the long form of write option.
---exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 --write=crc32 $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=crc32
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 $MYSQLD_DATADIR/test/t1.ibd
-
---echo [14b]: when server default checksum=crc32 rewrite new checksum=innodb with innochecksum
---echo # Also check the long form of write option.
---exec $INNOCHECKSUM --no-check --write=innodb $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=crc32 --write=innodb $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=innodb
---exec $INNOCHECKSUM --strict-check=innodb $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # start the server with innodb_checksum_algorithm=InnoDB
---let $restart_parameters= --innodb_checksum_algorithm=innodb
---source include/start_mysqld.inc
-
-INSERT INTO tab1 VALUES(2, 'Innochecksum CRC32');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-
---echo # Stop the server
---source include/shutdown_mysqld.inc
-
---echo [15]: when server default checksum=crc32 rewrite new checksum=none with innochecksum
---echo # Also check the short form of write option.
---exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --no-check -w none $MYSQLD_DATADIR/test/t1.ibd
-# Rewrite done, verify with --strict-check=none
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/t1.ibd
-
---echo # Start the server with checksum algorithm=none
---let $restart_parameters= --innodb_checksum_algorithm=none
---source include/start_mysqld.inc
-
-INSERT INTO tab1 VALUES(3, 'Innochecksum None');
-SELECT c1,c2 FROM tab1 order by c1,c2;
-DROP TABLE t1;
-
---echo # Stop the server
---source include/shutdown_mysqld.inc
-
---echo [16]: rewrite into new checksum=crc32 with innochecksum
---exec $INNOCHECKSUM --no-check --write=crc32 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # Restart the DB server with innodb_checksum_algorithm=crc32
---let $restart_parameters= --innodb_checksum_algorithm=crc32
---source include/start_mysqld.inc
-
-SELECT * FROM tab1;
-DELETE FROM tab1 where c1=3;
-SELECT c1,c2 FROM tab1 order by c1,c2;
-
---echo # Stop server
---source include/shutdown_mysqld.inc
-
---echo [17]: rewrite into new checksum=InnoDB
---exec $INNOCHECKSUM --no-check --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd
-
---echo # Restart the DB server with innodb_checksum_algorithm=InnoDB
---let $restart_parameters= --innodb_checksum_algorithm=innodb
---source include/start_mysqld.inc
-
-DELETE FROM tab1 where c1=2;
-SELECT * FROM tab1;
-
---echo # Stop server
---source include/shutdown_mysqld.inc
-
---echo [18]:check Innochecksum with invalid write options
---error 1
---exec $INNOCHECKSUM --no-check --write=strict_crc32 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'strict_crc32\' to \'write\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --no-check --write=strict_innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'strict_innodb\' to \'write\';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --no-check --write=crc23 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN=Error while setting value \'crc23\' to \'write\';
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
-# Cleanup
---let $restart_parameters=
---source include/start_mysqld.inc
-
-DROP TABLE tab1;
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
deleted file mode 100644
index 5bbafd986e5..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---skip-innodb-doublewrite
---innodb-file-per-table
---innodb-change-buffering=none
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
deleted file mode 100644
index 330bb81ba75..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum2.test
+++ /dev/null
@@ -1,118 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
---source include/have_debug.inc
---source include/no_valgrind_without_big.inc
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---source include/not_embedded.inc
--- source include/big_test.inc
-
---disable_query_log
-# This warning occurs due to small buffer pool size(i.e. 8MB). It doesn't occur
-# with --mysqld=--innodb_buffer_pool_size=10MB
-call mtr.add_suppression("\\[Warning\\] InnoDB: Difficult to find free blocks in the buffer pool.*");
---enable_query_log
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-
-SET GLOBAL innodb_compression_level=0;
-SELECT @@innodb_compression_level;
-
-CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200));
-let $i=10;
-while ($i > 0) {
- INSERT INTO t1 SELECT * from t1;
- dec $i;
-}
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
-# Page_type_dump for t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/t1.ibd
---file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo [1]:# check the both short and long options for "help"
---exec $INNOCHECKSUM --help $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---exec $INNOCHECKSUM -I $MYSQLD_DATADIR/test/t1.ibd > $MYSQLTEST_VARDIR/tmp/help_output_short.txt
---diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/help_output_short.txt
-
---echo [2]:# Run the innochecksum when file isn't provided.
---echo # It will print the innochecksum usage similar to --help option.
---error 1
---exec $INNOCHECKSUM > $MYSQLTEST_VARDIR/tmp/usage.txt
---diff_files $MYSQLTEST_VARDIR/tmp/help_output_long.txt $MYSQLTEST_VARDIR/tmp/usage.txt
---remove_file $MYSQLTEST_VARDIR/tmp/usage.txt
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-my $file= 'help_output_long.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/tmpfile" or die $!;
-while(<IN_FILE>) {
- unless ($_=~ /^debug.*$/ || $_=~ /\-#, \-\-debug.*$/ || $_=~ /http:.*html/) {
- $_=~ s/^\S*innochecksum.+Ver.+[0-9]*\.[0-9]*\.[0-9]*.+$/innochecksum Ver #.#.#/g;
- $_=~ s/(Copyright\s\(c\))\s([0-9]*),\s([0-9]*)(.*)/$1 YEAR, YEAR $4/g;
- $_=~ s/Usage:.*\[-c/Usage: innochecksum [-c/g;
- print OUT_FILE $_;
- }
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/tmpfile", "$dir/tmp/$file");
-EOF
-
---cat_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---remove_file $MYSQLTEST_VARDIR/tmp/help_output_long.txt
---remove_file $MYSQLTEST_VARDIR/tmp/help_output_short.txt
-
---echo [3]:# check the both short and long options for "count" and exit
---replace_regex /[0-9]+/#/
---exec $INNOCHECKSUM --count $MYSQLD_DATADIR/test/t1.ibd
---replace_regex /[0-9]+/#/
---exec $INNOCHECKSUM -c $MYSQLD_DATADIR/test/t1.ibd
-
---echo [4]:# Print the version of innochecksum and exit
---replace_regex /.*innochecksum.*Ver.*[0-9]*.[0-9]*.[0-9]*.*/innochecksum Ver #.#.#/
---exec $INNOCHECKSUM -V $MYSQLD_DATADIR/test/t1.ibd
-
---echo # Restart the DB server
---source include/start_mysqld.inc
-
-DROP TABLE t1;
-
---echo [5]:# Check the innochecksum for compressed table t1 with different key_block_size
---echo # Test for KEY_BLOCK_SIZE=1
---let $size=1
---source ../include/innodb-wl6045.inc
-
---echo # Test for KEY_BLOCK_SIZE=2
---let $size=2
---source ../include/innodb-wl6045.inc
-
---echo # Test for for KEY_BLOCK_SIZE=4
---let $size=4
---source ../include/innodb-wl6045.inc
-
-set innodb_strict_mode=off;
---echo # Test for for KEY_BLOCK_SIZE=8
---let $size=8
---source ../include/innodb-wl6045.inc
-
-set innodb_strict_mode=off;
---echo # Test for KEY_BLOCK_SIZE=16
---let $size=16
---source ../include/innodb-wl6045.inc
---echo # Test[5] completed
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt b/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
deleted file mode 100644
index 302a9872a26..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-file-per-table
diff --git a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test b/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
deleted file mode 100644
index dab10dcc997..00000000000
--- a/mysql-test/suite/innodb/t/innodb_zip_innochecksum3.test
+++ /dev/null
@@ -1,406 +0,0 @@
-#************************************************************
-# WL6045:Improve Innochecksum
-#************************************************************
---source include/innodb_page_size_small.inc
-
---source include/no_valgrind_without_big.inc
-
-# Embedded server does not support crashing.
---source include/not_embedded.inc
-
-# Avoid CrashReporter popup on Mac.
---source include/not_crashrep.inc
-
---echo # Set the environmental variables
-let MYSQLD_BASEDIR= `SELECT @@basedir`;
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-
-call mtr.add_suppression("InnoDB: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
-call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to.*");
-
---echo [1]: Further Test are for rewrite checksum (innodb|crc32|none) for all ibd file & start the server.
-
-CREATE TABLE tab1 (pk INTEGER NOT NULL PRIMARY KEY,
-linestring_key GEOMETRY NOT NULL,
-linestring_nokey GEOMETRY NOT NULL)
-ENGINE=InnoDB ;
-
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (1, ST_GeomFromText('POINT(10 10) '), ST_GeomFromText('POINT(10 10) '));
-
-CREATE INDEX linestring_index ON tab1(linestring_nokey(5));
-ALTER TABLE tab1 ADD KEY (linestring_key(5));
-
---echo # create a compressed table
-CREATE TABLE tab2(col_1 CHAR (255) ,
-col_2 VARCHAR (255), col_3 longtext,
-col_4 longtext,col_5 longtext,
-col_6 longtext , col_7 int )
-engine = innodb row_format=compressed key_block_size=4;
-
-CREATE INDEX idx1 ON tab2(col_3(10));
-CREATE INDEX idx2 ON tab2(col_4(10));
-CREATE INDEX idx3 ON tab2(col_5(10));
-
-# load the with repeat function
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-
-# insert 5 records
-let $i = 5;
-while ($i) {
- eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
- VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
- dec $i;
-}
-
---disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(a)]: Rewrite into new checksum=InnoDB for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=InnoDB $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=InnoDB $_")
-}
-EOF
-
---echo : start the server with innodb_checksum_algorithm=strict_innodb
---let $restart_parameters= --innodb_checksum_algorithm=strict_innodb
---source include/start_mysqld.inc
-
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (2, ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'), ST_GeomFromText('LINESTRING(10 10,20 20,30 30)'));
-
-# load the with repeat function
-SET @col_1 = repeat('a', 5);
-SET @col_2 = repeat('b', 20);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-
-# check the table status is GOOD with DML
-let $i = 6;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
--- disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(b)]: Rewrite into new checksum=crc32 for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=CRC32 $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=crc32 $_")
-}
-EOF
-
---echo # start the server with innodb_checksum_algorithm=strict_crc32
---let $restart_parameters= --innodb_checksum_algorithm=strict_crc32
---source include/start_mysqld.inc
-
-# check the table status is GOOD with DML
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (3, ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'),
-ST_GeomFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'));
-
-# load the with repeat function
-SET @col_1 = repeat('g', 5);
-SET @col_2 = repeat('h', 20);
-SET @col_3 = repeat('i', 100);
-SET @col_4 = repeat('j', 100);
-SET @col_5 = repeat('k', 100);
-SET @col_6 = repeat('l', 100);
-
-# check the table status is GOOD with DML
-let $i = 7;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
-# check the records from table
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
--- disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [1(c)]: Rewrite into new checksum=none for all *.ibd file and ibdata1
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/test/tab2.ibd
---exec $INNOCHECKSUM --write=none $MYSQLD_DATADIR/ibdata1
-perl;
-foreach (glob("$ENV{MYSQLD_DATADIR}/undo*")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=NONE $_")
-}
-foreach (glob("$ENV{MYSQLD_DATADIR}/*/*.ibd")) {
- system("$ENV{INNOCHECKSUM} --no-check --write=NONE $_")
-}
-EOF
-
---let $restart_parameters= --innodb_checksum_algorithm=strict_none
---source include/start_mysqld.inc
---let $restart_parameters=
-# check the table status is GOOD with DML
-INSERT INTO tab1 (pk, linestring_key, linestring_nokey)
-VALUES (4, ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '), ST_GeomFromText('MULTIPOINT(0 0,5 5,10 10,20 20) '));
-
-# load the with repeat function
-SET @col_1 = repeat('m', 5);
-SET @col_2 = repeat('n', 20);
-SET @col_3 = repeat('o', 100);
-SET @col_4 = repeat('p', 100);
-SET @col_5 = repeat('q', 100);
-SET @col_6 = repeat('r', 100);
-
-# check the table status is GOOD with DML
-let $i = 8;
-eval INSERT INTO tab2(col_1,col_2,col_3,col_4,col_5,col_6,col_7)
-VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,$i);
-
-# check the records from table
--- disable_result_log
-SELECT pk,ST_AsText(linestring_key),ST_AsText(linestring_nokey)
-FROM tab1 ORDER BY pk;
-
---disable_result_log
-SELECT * FROM tab2 ORDER BY col_7;
---enable_result_log
-
---echo # stop the server
---source include/shutdown_mysqld.inc
-
---echo [2]: Check the page type summary with shortform for tab1.ibd
---replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/
---exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_short.txt
-
---echo [3]: Check the page type summary with longform for tab1.ibd
---replace_regex /File.*.ibd/File::tab1.ibd/ /[0-9]+/#/
---exec $INNOCHECKSUM --page-type-summary $MYSQLD_DATADIR/test/tab1.ibd 2>$MYSQLTEST_VARDIR/tmp/page_summary_long.txt
-
---remove_file $MYSQLTEST_VARDIR/tmp/page_summary_short.txt
---remove_file $MYSQLTEST_VARDIR/tmp/page_summary_long.txt
---echo [4]: Page type dump for with longform for tab1.ibd
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $INNOCHECKSUM --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'dump.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace the intergers to # and complete file path to file name only.
- $_=~ s/Filename.+/Filename::tab1.ibd/g;
- $_=~ s/\d+/#/g;
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
---echo # Print the contents stored in dump.txt
-cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo # Variables used by page type dump for ibdata1
---exec $INNOCHECKSUM -v --page-type-dump $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/ibdata1 > $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt
-
---file_exists $MYSQLTEST_VARDIR/tmp/dump.txt
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'page_verbose_summary.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace complete file path to file name only.
- $_=~ s/$dir/MYSQLTEST_VARDIR/;
- # Remove debug option, which is not in all builds
- next if (/debug/);
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
-cat_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/page_verbose_summary.txt
-
---echo [5]: Page type dump for with shortform for tab1.ibd
---exec $INNOCHECKSUM -D $MYSQLTEST_VARDIR/tmp/dump.txt $MYSQLD_DATADIR/test/tab1.ibd
-
-perl;
-use strict;
-use warnings;
-use File::Copy;
-my $dir = $ENV{'MYSQLTEST_VARDIR'};
-opendir(DIR, $dir) or die $!;
-my $file= 'dump.txt';
-# open file in write mode
-open IN_FILE,"<", "$dir/tmp/$file" or die $!;
-open OUT_FILE, ">", "$dir/tmp/innochecksum_3_tempfile" or die $!;
-while(<IN_FILE>)
-{
- # Replace the intergers to # and complete file path to file name only.
- $_=~ s/Filename.+/Filename::tab1.ibd/g;
- $_=~ s/\d+/#/g;
- print OUT_FILE $_;
-}
-close(IN_FILE);
-close(OUT_FILE);
-# move the new content from tmp file to the orginal file.
-move ("$dir/tmp/innochecksum_3_tempfile", "$dir/tmp/$file");
-closedir(DIR);
-EOF
-
-# Print the contents stored in dump.txt
-cat_file $MYSQLTEST_VARDIR/tmp/dump.txt;
---remove_file $MYSQLTEST_VARDIR/tmp/dump.txt
-
---echo [6]: check the valid lower bound values for option
---echo # allow-mismatches,page,start-page,end-page
---exec $INNOCHECKSUM --allow-mismatches=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -a 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -p 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --start-page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -s 0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM --end-page=0 $MYSQLD_DATADIR/test/tab1.ibd
---exec $INNOCHECKSUM -e 0 $MYSQLD_DATADIR/test/tab1.ibd
-
-#
-# These produce now errors
-#
-#--echo [7]: check the negative values for option
-#--echo # allow-mismatches,page,start-page,end-page.
-#--echo # They will reset to zero for negative values.
-#--echo # check the invalid lower bound values
-#--exec $INNOCHECKSUM --allow-mismatches=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -a -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -p -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --start-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -s -1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --end-page=-1 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -e -1 $MYSQLD_DATADIR/test/tab1.ibd
-#
-#--echo [8]: check the valid upper bound values for
-#--echo # both short and long options "allow-mismatches" and "end-page"
-#
-#--exec $INNOCHECKSUM --allow-mismatches=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -a 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM --end-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-#--exec $INNOCHECKSUM -e 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd
-
---echo [9]: check the both short and long options "page" and "start-page" when
---echo # seek value is larger than file size.
---error 1
---exec $INNOCHECKSUM --page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -p 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --start-page=18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -s 18446744073709551615 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Error: Unable to seek to necessary offset: Invalid argument;
---source include/search_pattern_in_file.inc
-
---echo [34]: check the invalid upper bound values for options, allow-mismatches, end-page, start-page and page.
---echo # innochecksum will fail with error code: 1
---error 1
---exec $INNOCHECKSUM --allow-mismatches=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -a 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --end-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -e 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -p 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM --start-page=18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
-
---error 1
---exec $INNOCHECKSUM -s 18446744073709551616 $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
-let SEARCH_PATTERN= Incorrect unsigned integer value: '18446744073709551616';
---source include/search_pattern_in_file.inc
---remove_file $SEARCH_FILE
-
-# Cleanup
---source include/start_mysqld.inc
-
-DROP TABLE tab1,tab2;
diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test
index 5a80f7c49e3..cd1d827e157 100644
--- a/mysql-test/suite/innodb/t/truncate.test
+++ b/mysql-test/suite/innodb/t/truncate.test
@@ -17,18 +17,6 @@ disconnect dml;
DROP TABLE t;
--echo #
---echo # MDEV-17816 Crash in TRUNCATE TABLE when table creation fails
---echo #
-CREATE TABLE t1 (c VARCHAR(1024), KEY(c)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 SET c='character';
-# FIXME: MDEV-17833 ALTER TABLE is not enforcing prefix index size limit
-ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
---error ER_INDEX_COLUMN_TOO_LONG
-TRUNCATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
--echo # MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
--echo #
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
@@ -53,3 +41,12 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB;
--move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm
SELECT * FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO
+--echo #
+CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+TRUNCATE t1;
+SELECT * FROM t1;
+DROP TEMPORARY TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result
index f3650fb3dc9..896291854a8 100644
--- a/mysql-test/suite/innodb_fts/r/create.result
+++ b/mysql-test/suite/innodb_fts/r/create.result
@@ -162,3 +162,19 @@ SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word'
len COUNT(*)
84 6
DROP TABLE t;
+#
+# MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
+# trx_undo_page_report_modify upon optimizing table
+# under innodb_optimize_fulltext_only
+#
+CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES ('foo'),('bar');
+DELETE FROM t1 LIMIT 1;
+ALTER TABLE t1 ADD FULLTEXT KEY (f1);
+SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
+SET GLOBAL innodb_optimize_fulltext_only= 1;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+DROP TABLE t1;
+SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
diff --git a/mysql-test/suite/innodb_fts/t/create.test b/mysql-test/suite/innodb_fts/t/create.test
index fe0273af750..4e522994fcc 100644
--- a/mysql-test/suite/innodb_fts/t/create.test
+++ b/mysql-test/suite/innodb_fts/t/create.test
@@ -90,3 +90,19 @@ ENGINE=InnoDB;
# The column length should be 84 bytes (84 characters * 1 byte/character).
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
DROP TABLE t;
+
+--echo #
+--echo # MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in
+--echo # trx_undo_page_report_modify upon optimizing table
+--echo # under innodb_optimize_fulltext_only
+--echo #
+
+CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES ('foo'),('bar');
+DELETE FROM t1 LIMIT 1;
+ALTER TABLE t1 ADD FULLTEXT KEY (f1);
+SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only;
+SET GLOBAL innodb_optimize_fulltext_only= 1;
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save;
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.test b/mysql-test/suite/innodb_zip/t/innochecksum.test
index 63a4b418677..fec8acf52c4 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum.test
@@ -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
# Server Default checksum = crc32
+--error 1
--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 # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM --strict-check=none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [11]: check the innochecksum with short form -C innodb
--echo # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM -C innodb $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [12]: check the innochecksum with short form -C none
--echo # when server Default checksum=crc32
+--error 1
--exec $INNOCHECKSUM -C none $MYSQLD_DATADIR/test/tab1.ibd 2> $SEARCH_FILE
--echo [13]: check strict-check with invalid values
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.opt b/mysql-test/suite/mariabackup/encrypted_page_corruption.opt
new file mode 100644
index 00000000000..74a6450a1ef
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.opt
@@ -0,0 +1,6 @@
+--innodb-encrypt-log=ON
+--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
+--loose-file-key-management
+--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key
+--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc
+--loose-file-key-management-encryption-algorithm=aes_cbc
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.result b/mysql-test/suite/mariabackup/encrypted_page_corruption.result
new file mode 100644
index 00000000000..8ae34b2a6f0
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.result
@@ -0,0 +1,8 @@
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
+CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
+insert into t1 select repeat('a',100);
+# Corrupt the table
+# xtrabackup backup
+FOUND 1 /Database page corruption detected/ in backup.log
+drop table t1;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
new file mode 100644
index 00000000000..923875275e6
--- /dev/null
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
@@ -0,0 +1,51 @@
+--source include/have_file_key_management.inc
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Table `test`\\.`t1` has an unreadable root page");
+CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes;
+insert into t1 select repeat('a',100);
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Corrupt the table
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+
+my $ibd_file = $ENV{'t1_IBD'};
+
+my $chunk;
+my $len;
+
+sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
+sysseek IBD_FILE, 16384 * 3, SEEK_CUR;
+$chunk = '\xAA\xAA\xAA\xAA';
+syswrite IBD_FILE, $chunk, 4;
+
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+
+--let SEARCH_PATTERN=Database page corruption detected
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+
+drop table t1;
+rmdir $targetdir;
diff --git a/mysql-test/suite/perfschema/r/socket_connect.result b/mysql-test/suite/perfschema/r/socket_connect.result
index 1ac22f6ca34..304521b044f 100644
--- a/mysql-test/suite/perfschema/r/socket_connect.result
+++ b/mysql-test/suite/perfschema/r/socket_connect.result
@@ -167,19 +167,6 @@ connection default;
# 6.1 Verify that there are no TCP/IP connections in the socket instance table
-SELECT COUNT(*) = 0 AS 'Expect 1'
-FROM performance_schema.socket_instances
-WHERE EVENT_NAME LIKE '%client_connection%'
- AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
-AND (IP LIKE '%127.0.0.1' OR IP LIKE '%::1');
-Expect 1
-1
# 6.2 Verify that there are no TCP/IP connections in the summary instance table
-SELECT COUNT(*) = 0 AS 'Expect 1'
-FROM performance_schema.socket_summary_by_instance
-WHERE EVENT_NAME LIKE '%client_connection%'
- AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
-Expect 1
-1
diff --git a/mysql-test/suite/perfschema/t/socket_connect.test b/mysql-test/suite/perfschema/t/socket_connect.test
index 909840144ef..b4579605eb5 100644
--- a/mysql-test/suite/perfschema/t/socket_connect.test
+++ b/mysql-test/suite/perfschema/t/socket_connect.test
@@ -273,18 +273,21 @@ WHERE EVENT_NAME LIKE '%client_connection%'
--echo
--echo # 6.1 Verify that there are no TCP/IP connections in the socket instance table
--echo
-eval SELECT COUNT(*) = 0 AS 'Expect 1'
+let $wait_condition=
+SELECT COUNT(*) = 0 AS 'Expect 1'
FROM performance_schema.socket_instances
WHERE EVENT_NAME LIKE '%client_connection%'
AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin
AND $ip_localhost;
+--source include/wait_condition.inc
--echo
--echo # 6.2 Verify that there are no TCP/IP connections in the summary instance table
--echo
-eval SELECT COUNT(*) = 0 AS 'Expect 1'
+let $wait_condition=
+SELECT COUNT(*) = 0 AS 'Expect 1'
FROM performance_schema.socket_summary_by_instance
WHERE EVENT_NAME LIKE '%client_connection%'
AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
-
+--source include/wait_condition.inc
exit;
diff --git a/mysql-test/suite/roles/flush_roles-17898.result b/mysql-test/suite/roles/flush_roles-17898.result
new file mode 100644
index 00000000000..dbe6ea24afd
--- /dev/null
+++ b/mysql-test/suite/roles/flush_roles-17898.result
@@ -0,0 +1,13 @@
+use mysql;
+insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
+insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
+insert ignore user (user,show_db_priv,is_role) values ('dwr_foo','N','Y'), ('dwr_bar','N','Y'), ('dwr_qux_dev','Y','Y');
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+Warning 1364 Field 'authentication_string' doesn't have a default value
+flush privileges;
+drop role dwr_foo;
+drop role dwr_bar;
+drop role dwr_qux_dev;
diff --git a/mysql-test/suite/roles/flush_roles-17898.test b/mysql-test/suite/roles/flush_roles-17898.test
new file mode 100644
index 00000000000..6a3b8d6f345
--- /dev/null
+++ b/mysql-test/suite/roles/flush_roles-17898.test
@@ -0,0 +1,11 @@
+#
+# MDEV-17898 FLUSH PRIVILEGES crashes server with segfault
+#
+use mysql;
+insert db (db,user,select_priv) values ('foo','dwr_foo','Y'), ('bar','dwr_bar','Y');
+insert roles_mapping (user,role) values ('dwr_qux_dev','dwr_foo'),('dwr_qux_dev','dwr_bar');
+insert ignore user (user,show_db_priv,is_role) values ('dwr_foo','N','Y'), ('dwr_bar','N','Y'), ('dwr_qux_dev','Y','Y');
+flush privileges;
+drop role dwr_foo;
+drop role dwr_bar;
+drop role dwr_qux_dev;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index 5cf28b6e49a..3c5542f4b2f 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -162,6 +162,7 @@ EOF
wait
EOF
START SLAVE;
+--error 0,2006,2013
SET GLOBAL debug_dbug="+d,crash_commit_before";
--connection server_1
@@ -186,6 +187,7 @@ EOF
wait
EOF
START SLAVE;
+--error 0,2006,2013
SET GLOBAL debug_dbug="+d,crash_commit_after";
--connection server_1
diff --git a/scripts/mytop.sh b/scripts/mytop.sh
index 17a87e9efd2..3ef0a59f27f 100644
--- a/scripts/mytop.sh
+++ b/scripts/mytop.sh
@@ -437,7 +437,7 @@ while (1)
if ($key eq 'C')
{
- if ( $HAS_COLOR )
+ if ( $HAS_COLOR )
{
$HAS_COLOR = 0;
}
@@ -817,11 +817,11 @@ sub GetData()
if ($config{header})
{
my @recs = "";
- if ( $db_release > 4 )
+ if ( $db_release > 4 )
{
@recs = Hashes("show global status");
- }
- else
+ }
+ else
{
@recs = Hashes("show status");
}
@@ -978,7 +978,7 @@ sub GetData()
# 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",
- ( $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,
( # slow now (qps)
($STATUS{Slow_queries} ) ?
@@ -989,7 +989,7 @@ sub GetData()
$STATUS{Threads_running},
$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)
) ) / ($q_diff ),
(100 * ($STATUS{Com_insert} - $OLD_STATUS{Com_insert} +
@@ -1075,7 +1075,7 @@ sub GetData()
$t_delta,
($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) /
$t_delta,
- ($STATUS{Handler_tmp_write}
+ ($STATUS{Handler_tmp_write}
-$OLD_STATUS{Handler_tmp_write})/$t_delta,
($STATUS{Handler_tmp_update} -
$OLD_STATUS{Handler_tmp_update})/$t_delta);
@@ -1119,6 +1119,7 @@ sub GetData()
}
}
print " Replication ";
+ print "Master:$data->{Master_Host} ";
print "IO:$data->{Slave_IO_Running} ";
print "SQL:$data->{Slave_SQL_Running} ";
print RESET() if ($HAS_COLOR);
@@ -1225,9 +1226,9 @@ sub GetData()
$thread->{State} ||= "";
$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
- $thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
+ $thread->{Info} =~ s~\s--(.*)$~ /* $1 */ ~mg;
## Normalize spaces -- mostly disabled for now. This can
## break EXPLAIN if you try to explain a mangled query. It
diff --git a/sql/item.cc b/sql/item.cc
index 529abad08cc..71a9afd6a9d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -10652,6 +10652,9 @@ const char *dbug_print_unit(SELECT_LEX_UNIT *un)
return "Couldn't fit into buffer";
}
+const char *dbug_print(Item *x) { return dbug_print_item(x); }
+const char *dbug_print(SELECT_LEX *x) { return dbug_print_select(x); }
+const char *dbug_print(SELECT_LEX_UNIT *x) { return dbug_print_unit(x); }
#endif /*DBUG_OFF*/
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 94cfae2664a..0c6c585bff6 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2730,14 +2730,17 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
{
Field **field_ptr;
TABLE *table= param->table;
+ partition_info *part_info= NULL;
+ #ifdef WITH_PARTITION_STORAGE_ENGINE
+ part_info= table->part_info;
+ #endif
uint parts= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- Column_statistics* col_stats= (*field_ptr)->read_stats;
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index)
- && col_stats && !col_stats->no_stat_values_provided()
- && !((*field_ptr)->type() == MYSQL_TYPE_GEOMETRY))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index) &&
+ is_eits_usable(field))
parts++;
}
@@ -2755,10 +2758,10 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
uint max_key_len= 0;
for (field_ptr= table->field; *field_ptr; field_ptr++)
{
- if (bitmap_is_set(used_fields, (*field_ptr)->field_index))
+ Field *field= *field_ptr;
+ if (bitmap_is_set(used_fields, field->field_index))
{
- Field *field= *field_ptr;
- if (field->type() == MYSQL_TYPE_GEOMETRY)
+ if (!is_eits_usable(field))
continue;
uint16 store_length;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index f09bde6a965..e24038f96ab 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2626,6 +2626,23 @@ void partition_info::print_debug(const char *str, uint *value)
DBUG_PRINT("info", ("parser: %s", str));
DBUG_VOID_RETURN;
}
+
+bool partition_info::field_in_partition_expr(Field *field) const
+{
+ uint i;
+ for (i= 0; i < num_part_fields; i++)
+ {
+ if (field->eq(part_field_array[i]))
+ return TRUE;
+ }
+ for (i= 0; i < num_subpart_fields; i++)
+ {
+ if (field->eq(subpart_field_array[i]))
+ return TRUE;
+ }
+ return FALSE;
+}
+
#else /* WITH_PARTITION_STORAGE_ENGINE */
/*
For builds without partitioning we need to define these functions
diff --git a/sql/partition_info.h b/sql/partition_info.h
index e00a2c44341..95700dac517 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -392,6 +392,7 @@ private:
public:
bool set_read_partitions(List<char> *partition_names);
bool has_unique_name(partition_element *element);
+ bool field_in_partition_expr(Field *field) const;
bool vers_init_info(THD *thd);
bool vers_set_interval(Item *item, interval_type int_type, my_time_t start)
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 3727bf7d7ce..59ba324df31 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -594,7 +594,9 @@ bool ROLE_GRANT_PAIR::init(MEM_ROOT *mem, const char *username,
/* Flag to mark that on_node was already called for this role */
#define ROLE_OPENED (1L << 3)
-static DYNAMIC_ARRAY acl_hosts, acl_users, acl_dbs, acl_proxy_users;
+static DYNAMIC_ARRAY acl_hosts, acl_users, acl_proxy_users;
+static Dynamic_array<ACL_DB> acl_dbs(0U,50U);
+typedef Dynamic_array<ACL_DB>::CMP_FUNC acl_dbs_cmp;
static HASH acl_roles;
/*
An hash containing mappings user <--> role
@@ -2092,12 +2094,11 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
db.access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
}
#endif
- (void) push_dynamic(&acl_dbs,(uchar*) &db);
+ acl_dbs.push(db);
}
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
end_read_record(&read_record_info);
- freeze_size(&acl_dbs);
+ acl_dbs.sort((acl_dbs_cmp)acl_compare);
+ acl_dbs.freeze();
const Proxies_priv_table& proxies_priv_table= tables.proxies_priv_table();
if (proxies_priv_table.table_exists())
@@ -2176,7 +2177,7 @@ void acl_free(bool end)
free_root(&acl_memroot,MYF(0));
delete_dynamic(&acl_hosts);
delete_dynamic_with_callback(&acl_users, (FREE_FUNC) free_acl_user);
- delete_dynamic(&acl_dbs);
+ acl_dbs.free_memory();
delete_dynamic(&acl_wild_hosts);
delete_dynamic(&acl_proxy_users);
my_hash_free(&acl_check_hosts);
@@ -2214,7 +2215,8 @@ void acl_free(bool end)
bool acl_reload(THD *thd)
{
- DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_dbs, old_acl_proxy_users;
+ DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_proxy_users;
+ Dynamic_array<ACL_DB> old_acl_dbs(0U,0U);
HASH old_acl_roles, old_acl_roles_mappings;
MEM_ROOT old_mem;
int result;
@@ -2250,7 +2252,7 @@ bool acl_reload(THD *thd)
old_acl_dbs= acl_dbs;
my_init_dynamic_array(&acl_hosts, sizeof(ACL_HOST), 20, 50, MYF(0));
my_init_dynamic_array(&acl_users, sizeof(ACL_USER), 50, 100, MYF(0));
- my_init_dynamic_array(&acl_dbs, sizeof(ACL_DB), 50, 100, MYF(0));
+ acl_dbs.init(50, 100);
my_init_dynamic_array(&acl_proxy_users, sizeof(ACL_PROXY_USER), 50, 100, MYF(0));
my_hash_init2(&acl_roles,50, &my_charset_utf8_bin,
0, 0, 0, (my_hash_get_key) acl_role_get_key, 0,
@@ -2271,6 +2273,7 @@ bool acl_reload(THD *thd)
acl_roles_mappings= old_acl_roles_mappings;
acl_proxy_users= old_acl_proxy_users;
acl_dbs= old_acl_dbs;
+ old_acl_dbs.init(0,0);
acl_memroot= old_mem;
init_check_host();
}
@@ -2281,7 +2284,6 @@ bool acl_reload(THD *thd)
delete_dynamic(&old_acl_hosts);
delete_dynamic_with_callback(&old_acl_users, (FREE_FUNC) free_acl_user);
delete_dynamic(&old_acl_proxy_users);
- delete_dynamic(&old_acl_dbs);
my_hash_free(&old_acl_roles_mappings);
}
mysql_mutex_unlock(&acl_cache->lock);
@@ -2436,9 +2438,9 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host,
if (acl_user)
{
res= 0;
- for (i=0 ; i < acl_dbs.elements ; i++)
+ for (i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *acl_db= dynamic_element(&acl_dbs, i, ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
if (!acl_db->user ||
(user && user[0] && !strcmp(user, acl_db->user)))
{
@@ -2467,9 +2469,9 @@ bool acl_getroot(Security_context *sctx, const char *user, const char *host,
if (acl_role)
{
res= 0;
- for (i=0 ; i < acl_dbs.elements ; i++)
+ for (i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *acl_db= dynamic_element(&acl_dbs, i, ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
if (!acl_db->user ||
(user && user[0] && !strcmp(user, acl_db->user)))
{
@@ -2761,9 +2763,9 @@ static bool acl_update_db(const char *user, const char *host, const char *db,
bool updated= false;
- for (uint i=0 ; i < acl_dbs.elements ; i++)
+ for (uint i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
if ((!acl_db->user && !user[0]) ||
(acl_db->user &&
!strcmp(user,acl_db->user)))
@@ -2782,7 +2784,7 @@ static bool acl_update_db(const char *user, const char *host, const char *db,
acl_db->initial_access= acl_db->access;
}
else
- delete_dynamic_element(&acl_dbs,i);
+ acl_dbs.del(i);
updated= true;
}
}
@@ -2817,9 +2819,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
acl_db.db=strdup_root(&acl_memroot,db);
acl_db.initial_access= acl_db.access= privileges;
acl_db.sort=get_sort(3,acl_db.host.hostname,acl_db.db,acl_db.user);
- (void) push_dynamic(&acl_dbs,(uchar*) &acl_db);
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
+ acl_dbs.push(acl_db);
+ acl_dbs.sort((acl_dbs_cmp)acl_compare);
}
@@ -2865,9 +2866,9 @@ ulong acl_get(const char *host, const char *ip,
/*
Check if there are some access rights for database and user
*/
- for (i=0 ; i < acl_dbs.elements ; i++)
+ for (i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
if (!acl_db->user || !strcmp(user,acl_db->user))
{
if (compare_hostname(&acl_db->host,host,ip))
@@ -5761,15 +5762,15 @@ static bool merge_role_global_privileges(ACL_ROLE *grantee)
return old != grantee->access;
}
-static int db_name_sort(ACL_DB * const *db1, ACL_DB * const *db2)
+static int db_name_sort(const int *db1, const int *db2)
{
- return strcmp((*db1)->db, (*db2)->db);
+ return strcmp(acl_dbs.at(*db1).db, acl_dbs.at(*db2).db);
}
/**
update ACL_DB for given database and a given role with merged privileges
- @param merged ACL_DB of the role in question (or NULL if it wasn't found)
+ @param merged ACL_DB of the role in question (or -1 if it wasn't found)
@param first first ACL_DB in an array for the database in question
@param access new privileges for the given role on the gived database
@param role the name of the given role
@@ -5779,15 +5780,15 @@ static int db_name_sort(ACL_DB * const *db1, ACL_DB * const *db2)
2 - ACL_DB was added
4 - ACL_DB was deleted
*/
-static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
+static int update_role_db(int merged, int first, ulong access,
const char *role)
{
- if (!first)
+ if (first < 0)
return 0;
DBUG_EXECUTE_IF("role_merge_stats", role_db_merges++;);
- if (merged == NULL)
+ if (merged < 0)
{
/*
there's no ACL_DB for this role (all db grants come from granted roles)
@@ -5802,11 +5803,11 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
acl_db.user= role;
acl_db.host.hostname= const_cast<char*>("");
acl_db.host.ip= acl_db.host.ip_mask= 0;
- acl_db.db= first[0]->db;
+ acl_db.db= acl_dbs.at(first).db;
acl_db.access= access;
acl_db.initial_access= 0;
acl_db.sort=get_sort(3, "", acl_db.db, role);
- push_dynamic(&acl_dbs,(uchar*) &acl_db);
+ acl_dbs.push(acl_db);
return 2;
}
else if (access == 0)
@@ -5822,13 +5823,13 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
2. it's O(N) operation, and we may need many of them
so we only mark elements deleted and will delete later.
*/
- merged->sort= 0; // lower than any valid ACL_DB sort value, will be sorted last
+ acl_dbs.at(merged).sort= 0; // lower than any valid ACL_DB sort value, will be sorted last
return 4;
}
- else if (merged->access != access)
+ else if (acl_dbs.at(merged).access != access)
{
/* this is easy */
- merged->access= access;
+ acl_dbs.at(merged).access= access;
return 1;
}
return 0;
@@ -5843,7 +5844,7 @@ static int update_role_db(ACL_DB *merged, ACL_DB **first, ulong access,
static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
role_hash_t *rhash)
{
- Dynamic_array<ACL_DB *> dbs;
+ Dynamic_array<int> dbs;
/*
Supposedly acl_dbs can be huge, but only a handful of db grants
@@ -5851,9 +5852,9 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
Collect these applicable db grants.
*/
- for (uint i=0 ; i < acl_dbs.elements ; i++)
+ for (uint i=0 ; i < acl_dbs.elements() ; i++)
{
- ACL_DB *db= dynamic_element(&acl_dbs,i,ACL_DB*);
+ ACL_DB *db= &acl_dbs.at(i);
if (db->host.hostname[0])
continue;
if (dbname && strcmp(db->db, dbname))
@@ -5861,7 +5862,7 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
ACL_ROLE *r= rhash->find(db->user, strlen(db->user));
if (!r)
continue;
- dbs.append(db);
+ dbs.append(i);
}
dbs.sort(db_name_sort);
@@ -5870,21 +5871,21 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
(that should be merged) are sorted together. The grantee's ACL_DB element
is not necessarily the first and may be not present at all.
*/
- ACL_DB **first= NULL, *merged= NULL;
+ int first= -1, merged= -1;
ulong access= 0, update_flags= 0;
- for (ACL_DB **cur= dbs.front(); cur <= dbs.back(); cur++)
+ for (int *p= dbs.front(); p <= dbs.back(); p++)
{
- if (!first || (!dbname && strcmp(cur[0]->db, cur[-1]->db)))
+ if (first<0 || (!dbname && strcmp(acl_dbs.at(*p).db, acl_dbs.at(*p-1).db)))
{ // new db name series
update_flags|= update_role_db(merged, first, access, grantee->user.str);
- merged= NULL;
+ merged= -1;
access= 0;
- first= cur;
+ first= *p;
}
- if (strcmp(cur[0]->user, grantee->user.str) == 0)
- access|= (merged= cur[0])->initial_access;
+ if (strcmp(acl_dbs.at(*p).user, grantee->user.str) == 0)
+ access|= acl_dbs.at(merged= *p).initial_access;
else
- access|= cur[0]->access;
+ access|= acl_dbs.at(*p).access;
}
update_flags|= update_role_db(merged, first, access, grantee->user.str);
@@ -5897,14 +5898,12 @@ static bool merge_role_db_privileges(ACL_ROLE *grantee, const char *dbname,
*/
if (update_flags & (2|4))
{ // inserted or deleted, need to sort
- my_qsort((uchar*) dynamic_element(&acl_dbs,0,ACL_DB*),acl_dbs.elements,
- sizeof(ACL_DB),(qsort_cmp) acl_compare);
+ acl_dbs.sort((acl_dbs_cmp)acl_compare);
}
if (update_flags & 4)
{ // deleted, trim the end
- while (acl_dbs.elements &&
- dynamic_element(&acl_dbs, acl_dbs.elements-1, ACL_DB*)->sort == 0)
- acl_dbs.elements--;
+ while (acl_dbs.elements() && acl_dbs.back()->sort == 0)
+ acl_dbs.pop();
}
return update_flags;
}
@@ -8859,16 +8858,14 @@ static bool show_database_privileges(THD *thd, const char *username,
const char *hostname,
char *buff, size_t buffsize)
{
- ACL_DB *acl_db;
ulong want_access;
- uint counter;
Protocol *protocol= thd->protocol;
- for (counter=0 ; counter < acl_dbs.elements ; counter++)
+ for (uint i=0 ; i < acl_dbs.elements() ; i++)
{
const char *user, *host;
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ ACL_DB *acl_db= &acl_dbs.at(i);
user= safe_str(acl_db->user);
host=acl_db->host.hostname;
@@ -9624,7 +9621,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
elements= acl_users.elements;
break;
case DB_ACL:
- elements= acl_dbs.elements;
+ elements= int(acl_dbs.elements());
break;
case COLUMN_PRIVILEGES_HASH:
grant_name_hash= &column_priv_hash;
@@ -9676,7 +9673,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
break;
case DB_ACL:
- acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
+ acl_db= &acl_dbs.at(idx);
user= acl_db->user;
host= acl_db->host.hostname;
break;
@@ -9762,7 +9759,7 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
break;
case DB_ACL:
- delete_dynamic_element(&acl_dbs, idx);
+ acl_dbs.del(idx);
break;
case COLUMN_PRIVILEGES_HASH:
@@ -10665,11 +10662,11 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
*/
do
{
- for (counter= 0, revoked= 0 ; counter < acl_dbs.elements ; )
+ for (counter= 0, revoked= 0 ; counter < acl_dbs.elements() ; )
{
const char *user,*host;
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ acl_db=&acl_dbs.at(counter);
user= safe_str(acl_db->user);
host= safe_str(acl_db->host.hostname);
@@ -11272,6 +11269,14 @@ static int show_column_grants(THD *thd, SHOW_VAR *var, char *buff,
return 0;
}
+static int show_database_grants(THD *thd, SHOW_VAR *var, char *buff,
+ enum enum_var_type scope)
+{
+ var->type= SHOW_UINT;
+ var->value= buff;
+ *(uint *)buff= uint(acl_dbs.elements());
+ return 0;
+}
#else
bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool)
@@ -11283,7 +11288,7 @@ bool check_grant(THD *, ulong, TABLE_LIST *, bool, uint, bool)
SHOW_VAR acl_statistics[] = {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
{"column_grants", (char*)show_column_grants, SHOW_SIMPLE_FUNC},
- {"database_grants", (char*)&acl_dbs.elements, SHOW_UINT},
+ {"database_grants", (char*)show_database_grants, SHOW_SIMPLE_FUNC},
{"function_grants", (char*)&func_priv_hash.records, SHOW_ULONG},
{"procedure_grants", (char*)&proc_priv_hash.records, SHOW_ULONG},
{"package_spec_grants", (char*)&package_spec_priv_hash.records, SHOW_ULONG},
@@ -11556,11 +11561,11 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(0);
mysql_mutex_lock(&acl_cache->lock);
- for (counter=0 ; counter < acl_dbs.elements ; counter++)
+ for (counter=0 ; counter < acl_dbs.elements() ; counter++)
{
const char *user, *host, *is_grantable="YES";
- acl_db=dynamic_element(&acl_dbs,counter,ACL_DB*);
+ acl_db=&acl_dbs.at(counter);
user= safe_str(acl_db->user);
host= safe_str(acl_db->host.hostname);
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 0e5246b7e2a..0f18a89360a 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -123,8 +123,7 @@ public:
void init(uint prealloc=16, uint increment=16)
{
- my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment,
- MYF(0));
+ init_dynamic_array2(&array, sizeof(Elem), 0, prealloc, increment, MYF(0));
}
/**
@@ -218,6 +217,11 @@ public:
set_dynamic(&array, &el, idx);
}
+ void freeze()
+ {
+ freeze_size(&array);
+ }
+
bool resize(size_t new_size, Elem default_val)
{
size_t old_size= elements();
@@ -252,7 +256,7 @@ public:
my_qsort(array.buffer, array.elements, sizeof(Elem), (qsort_cmp)cmp_func);
}
- typedef int (*CMP_FUNC2)(const Elem *el1, const Elem *el2, void *);
+ typedef int (*CMP_FUNC2)(void *, const Elem *el1, const Elem *el2);
void sort(CMP_FUNC2 cmp_func, void *data)
{
my_qsort2(array.buffer, array.elements, sizeof(Elem), (qsort2_cmp)cmp_func, data);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index e4f3171bd14..a42a2f5afdd 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2018, MariaDB Corporation.
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
@@ -4792,7 +4792,8 @@ extern "C" int thd_slave_thread(const MYSQL_THD thd)
extern "C" int thd_rpl_stmt_based(const MYSQL_THD thd)
{
- return !thd->is_current_stmt_binlog_format_row() &&
+ return thd &&
+ !thd->is_current_stmt_binlog_format_row() &&
!thd->is_current_stmt_binlog_disabled();
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 69ea04a170c..817447fe917 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -670,7 +670,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
(HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE)) == 0))
{
my_error(ER_KEY_DOESNT_SUPPORT, MYF(0),
- table->file->index_type(handler->keyno), keyinfo->name);
+ table->file->index_type(handler->keyno), keyinfo->name.str);
return 1;
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 544ae1e4f8c..233e0313121 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -602,7 +602,8 @@ void init_update_queries(void)
sql_command_flags[SQLCOM_DELETE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
- CF_CAN_BE_EXPLAINED;
+ CF_CAN_BE_EXPLAINED |
+ CF_SP_BULK_SAFE;
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE |
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 04806f07b3b..2384c68115b 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -31,6 +31,7 @@
#include "uniques.h"
#include "my_atomic.h"
#include "sql_show.h"
+#include "sql_partition.h"
/*
The system variable 'use_stat_tables' can take one of the
@@ -3725,6 +3726,22 @@ void set_statistics_for_table(THD *thd, TABLE *table)
(use_stat_table_mode <= COMPLEMENTARY ||
!table->stats_is_read || read_stats->cardinality_is_null) ?
table->file->stats.records : read_stats->cardinality;
+
+ /*
+ For partitioned table, EITS statistics is based on data from all partitions.
+
+ On the other hand, Partition Pruning figures which partitions will be
+ accessed and then computes the estimate of rows in used_partitions.
+
+ Use the estimate from Partition Pruning as it is typically more precise.
+ Ideally, EITS should provide per-partition statistics but this is not
+ implemented currently.
+ */
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (table->part_info)
+ table->used_stat_records= table->file->stats.records;
+#endif
+
KEY *key_info, *key_info_end;
for (key_info= table->key_info, key_info_end= key_info+table->s->keys;
key_info < key_info_end; key_info++)
@@ -4043,3 +4060,29 @@ bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table)
}
return false;
}
+
+/*
+ Check wheter we can use EITS statistics for a field or not
+
+ TRUE : Use EITS for the columns
+ FALSE: Otherwise
+*/
+
+bool is_eits_usable(Field *field)
+{
+ /*
+ (1): checks if we have EITS statistics for a particular column
+ (2): Don't use EITS for GEOMETRY columns
+ (3): Disabling reading EITS statistics for columns involved in the
+ partition list of a table. We assume the selecticivity for
+ such columns would be handled during partition pruning.
+ */
+ Column_statistics* col_stats= field->read_stats;
+ return col_stats && !col_stats->no_stat_values_provided() && //(1)
+ field->type() != MYSQL_TYPE_GEOMETRY && //(2)
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ (!field->table->part_info ||
+ !field->table->part_info->field_in_partition_expr(field)) && //(3)
+#endif
+ true;
+}
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 39cddf95188..89758f002ca 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -112,6 +112,7 @@ double get_column_range_cardinality(Field *field,
key_range *max_endp,
uint range_flag);
bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table);
+bool is_eits_usable(Field* field);
class Histogram
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b9fc431feb1..ba91b208d03 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7401,11 +7401,6 @@ static bool mysql_inplace_alter_table(THD *thd,
bool reopen_tables= false;
bool res;
- /*
- Set the truncated column values of thd as warning
- for alter table.
- */
- thd->count_cuted_fields = CHECK_FIELD_WARN;
DBUG_ENTER("mysql_inplace_alter_table");
/*
@@ -9694,9 +9689,16 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
if (use_inplace)
{
table->s->frm_image= &frm;
+ enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
+ /*
+ Set the truncated column values of thd as warning
+ for alter table.
+ */
+ thd->count_cuted_fields = CHECK_FIELD_WARN;
int res= mysql_inplace_alter_table(thd, table_list, table, altered_table,
&ha_alter_info, inplace_supported,
&target_mdl_request, &alter_ctx);
+ thd->count_cuted_fields= save_count_cuted_fields;
my_free(const_cast<uchar*>(frm.str));
if (res)
diff --git a/sql/structs.h b/sql/structs.h
index be9abbf4613..5cc392c33b7 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -109,8 +109,8 @@ typedef struct st_key {
pk2 is explicitly present in idx1, it is not in the extension, so
ext_key_part_map.is_set(1) == false
*/
- LEX_CSTRING name;
key_part_map ext_key_part_map;
+ LEX_CSTRING name;
uint block_size;
enum ha_key_alg algorithm;
/*
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index e0bc7006770..0c56008a57a 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -196,8 +196,6 @@ IF(MSVC)
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
ENDIF()
-ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
-
-IF(TARGET innobase)
- ADD_DEPENDENCIES(innobase GenError)
+IF(NOT (PLUGIN_INNOBASE STREQUAL DYNAMIC))
+ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
ENDIF()
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 2ba311fce7b..b8f9a55b148 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -967,6 +967,25 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
field_max_size = dict_col_get_max_size(col);
if (UNIV_UNLIKELY(!field_max_size)) {
+ switch (col->mtype) {
+ case DATA_CHAR:
+ case DATA_MYSQL:
+ /* CHAR(0) is a possible data type.
+ The InnoDB internal SQL parser maps
+ CHAR to DATA_VARCHAR, so DATA_CHAR (or
+ DATA_MYSQL) is only coming from the
+ MariaDB SQL layer. */
+ if (comp) {
+ /* Add a length byte, because
+ fixed-length empty field are
+ encoded as variable-length.
+ For ROW_FORMAT=REDUNDANT,
+ these bytes were added to
+ rec_max_size before this loop. */
+ rec_max_size++;
+ }
+ continue;
+ }
/* SYS_FOREIGN.ID is defined as CHAR in the
InnoDB internal SQL parser, which translates
into the incorrect VARCHAR(0). InnoDB does
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index dd9dca496fb..7133f3cfd7e 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -754,17 +754,14 @@ buf_page_is_zeroes(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2,
- bool use_legacy_big_endian)
+ ulint checksum_field2)
{
- const uint32_t crc32 = buf_calc_page_crc32(read_buf,
- use_legacy_big_endian);
+ const uint32_t crc32 = buf_calc_page_crc32(read_buf);
#ifdef UNIV_INNOCHECKSUM
if (log_file
@@ -778,25 +775,14 @@ buf_page_is_checksum_valid_crc32(
#endif /* UNIV_INNOCHECKSUM */
if (checksum_field1 != checksum_field2) {
- goto invalid;
- }
-
- if (checksum_field1 == crc32) {
- return(true);
- } else {
- const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf, true);
-
- if (checksum_field1 == crc32_legacy) {
- return(true);
- }
+ return false;
}
-invalid:
- DBUG_LOG("checksum", "Page checksum crc32 not valid"
- << " field1 " << checksum_field1
- << " field2 " << checksum_field2
- << " crc32 " << crc32);
- return(false);
+ return checksum_field1 == crc32
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ || checksum_field1 == buf_calc_page_crc32(read_buf, true)
+#endif
+ ;
}
/** Checks if the page is in innodb checksum format.
@@ -925,6 +911,29 @@ buf_page_is_checksum_valid_none(
&& checksum_field1 == BUF_NO_CHECKSUM_MAGIC);
}
+#ifdef INNODB_BUG_ENDIAN_CRC32
+/** Validate the CRC-32C checksum of a page.
+@param[in] page buffer page (srv_page_size bytes)
+@param[in] checksum CRC-32C checksum stored on page
+@return computed checksum */
+static uint32_t buf_page_check_crc32(const byte* page, uint32_t checksum)
+{
+ uint32_t crc32 = buf_calc_page_crc32(page);
+
+ if (checksum != crc32) {
+ crc32 = buf_calc_page_crc32(page, true);
+ }
+
+ return crc32;
+}
+#else /* INNODB_BUG_ENDIAN_CRC32 */
+/** Validate the CRC-32C checksum of a page.
+@param[in] page buffer page (srv_page_size bytes)
+@param[in] checksum CRC-32C checksum stored on page
+@return computed checksum */
+# define buf_page_check_crc32(page, checksum) buf_calc_page_crc32(page)
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
+
/** Check if a page is corrupt.
@param[in] check_lsn whether the LSN should be checked
@param[in] read_buf database page
@@ -942,18 +951,21 @@ buf_page_is_corrupted(
const void* space)
#endif
{
- size_t checksum_field1 = 0;
- size_t checksum_field2 = 0;
#ifndef UNIV_INNOCHECKSUM
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
#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);
/* We can trust page type if page compression is set on tablespace
flags because page compression flag means file must have been
created with 10.1 (later than 5.5 code base). In 10.1 page
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
is not compressed or encrypted. Page checksum is verified
after decompression (i.e. normally pages are already
@@ -974,13 +986,7 @@ buf_page_is_corrupted(
/* Stored log sequence numbers at the start and the end
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 + srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)
- << " do not match";
-#endif /* UNIV_INNOCHECKSUM */
+
return(true);
}
@@ -1041,73 +1047,39 @@ buf_page_is_corrupted(
&& *reinterpret_cast<const ib_uint64_t*>(
read_buf + FIL_PAGE_LSN) == 0) {
- ulint i;
-
/* make sure that the page is really empty */
- for (i = 0; i < page_size.logical(); ++i) {
-
- /* The FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID has been
- 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;
+ for (ulint i = 0; i < page_size.logical(); i++) {
+ if (read_buf[i] != 0) {
+ return(true);
}
}
#ifdef UNIV_INNOCHECKSUM
- if (i >= page_size.logical()) {
- if (log_file) {
- fprintf(log_file, "Page::%llu"
- " is empty and uncorrupted\n",
- cur_page_num);
- }
- return(false);
+ if (log_file) {
+ fprintf(log_file, "Page::%llu"
+ " is empty and uncorrupted\n",
+ cur_page_num);
}
-#else
- return(i < page_size.logical());
#endif /* UNIV_INNOCHECKSUM */
+ return(false);
}
-#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 =
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
- bool legacy_checksum_checked = false;
-
switch (curr_algo) {
- case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
-
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, false)) {
- return(false);
- }
-
+ return !buf_page_is_checksum_valid_crc32(
+ read_buf, checksum_field1, checksum_field2);
+ 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,
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
if (log_file) {
fprintf(log_file, "page::%llu;"
@@ -1125,173 +1097,97 @@ buf_page_is_corrupted(
checksum_field1);
}
#endif /* UNIV_INNOCHECKSUM */
-
- return(false);
- }
-
- /* 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) {
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2, true)) {
-
- return(false);
- }
- legacy_checksum_checked = true;
+ return false;
}
- if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2)) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_INNODB,
- page_id);
-#endif
- }
-
- return(false);
- }
+ /* Very old versions of InnoDB only stored 8 byte lsn to the
+ start and the end of the page. */
- /* If legacy checksum is not checked, do it now. */
- if (!legacy_checksum_checked && buf_page_is_checksum_valid_crc32(
- read_buf, checksum_field1, checksum_field2, true)) {
+ /* Since innodb_checksum_algorithm is not strict_* allow
+ any of the algos to match for the old field */
- legacy_big_endian_checksum = true;
- return(false);
- }
+ if (checksum_field2
+ != mach_read_from_4(read_buf + FIL_PAGE_LSN)
+ && checksum_field2 != BUF_NO_CHECKSUM_MAGIC) {
-#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);
+ if (srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_CRC32) {
+ crc32 = buf_page_check_crc32(read_buf,
+ checksum_field2);
+ crc32_inited = true;
- case SRV_CHECKSUM_ALGORITHM_INNODB:
- case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
+ 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 (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2)) {
- return(false);
- }
+ if (checksum_field2
+ != buf_calc_page_old_checksum(read_buf)) {
+ crc32 = buf_page_check_crc32(
+ read_buf, checksum_field2);
+ crc32_inited = true;
- 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
- if (log_file) {
- fprintf(log_file, "page::%llu;"
- " old style: calculated = %u;"
- " recorded = %zu;\n", cur_page_num,
- buf_calc_page_old_checksum(read_buf),
- checksum_field2);
- fprintf(log_file, "page::%llu;"
- " new style: calculated = %u;"
- " crc32 = %u; recorded = %zu;\n",
- cur_page_num,
- buf_calc_page_new_checksum(read_buf),
- buf_calc_page_crc32(read_buf),
- checksum_field1);
+ if (checksum_field2 != crc32) {
+ return true;
+ }
+ }
}
-#endif /* UNIV_INNOCHECKSUM */
-
- 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)) {
+ if (checksum_field1 == 0
+ || checksum_field1 == BUF_NO_CHECKSUM_MAGIC) {
+ } else if (srv_checksum_algorithm
+ == SRV_CHECKSUM_ALGORITHM_CRC32) {
- if (curr_algo
- == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
-#ifndef UNIV_INNOCHECKSUM
- page_warn_strict_checksum(
- curr_algo,
- SRV_CHECKSUM_ALGORITHM_CRC32,
- page_id);
-#endif
+ if (!crc32_inited) {
+ crc32 = buf_page_check_crc32(
+ read_buf, checksum_field2);
+ crc32_inited = true;
}
- return(false);
- }
-
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Fail; page::%llu;"
- " invalid (fails innodb checksum)\n",
- cur_page_num);
- }
-#endif /* UNIV_INNOCHECKSUM */
-
- return(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);
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
+ if (checksum_field1
+ != buf_calc_page_new_checksum(read_buf)) {
- 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 (!crc32_inited) {
+ crc32 = buf_page_check_crc32(
+ read_buf, checksum_field2);
+ crc32_inited = true;
+ }
- 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);
+ if (checksum_field1 != crc32) {
+ return true;
+ }
+ }
}
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Fail; page::%llu;"
- " invalid (fails none checksum)\n",
- cur_page_num);
+ if (crc32_inited
+ && ((checksum_field1 == crc32
+ && checksum_field2 != crc32)
+ || (checksum_field1 != crc32
+ && checksum_field2 == crc32))) {
+ return true;
}
-#endif /* UNIV_INNOCHECKSUM */
-
- return(true);
+ break;
case SRV_CHECKSUM_ALGORITHM_NONE:
/* should have returned false earlier */
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
@@ -1374,10 +1270,12 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< page_zip_calc_checksum(
read_buf, page_size.physical(),
SRV_CHECKSUM_ALGORITHM_CRC32)
+#ifdef INNODB_BUG_ENDIAN_CRC32
<< "/"
<< page_zip_calc_checksum(
read_buf, page_size.physical(),
SRV_CHECKSUM_ALGORITHM_CRC32, true)
+#endif
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB)
@@ -1403,9 +1301,10 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
} else {
const uint32_t crc32 = buf_calc_page_crc32(read_buf);
-
+#ifdef INNODB_BUG_ENDIAN_CRC32
const uint32_t crc32_legacy = buf_calc_page_crc32(read_buf,
true);
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
ulint page_type = fil_page_get_type(read_buf);
ib::info() << "Uncompressed page, stored checksum in field1 "
@@ -1414,7 +1313,10 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< ", calculated checksums for field1: "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_CRC32) << " "
- << crc32 << "/" << crc32_legacy
+ << crc32
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ << "/" << crc32_legacy
+#endif
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB) << " "
@@ -1431,7 +1333,10 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size)
<< ", calculated checksums for field2: "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_CRC32) << " "
- << crc32 << "/" << crc32_legacy
+ << crc32
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ << "/" << crc32_legacy
+#endif
<< ", "
<< buf_checksum_algorithm_name(
SRV_CHECKSUM_ALGORITHM_INNODB) << " "
@@ -4068,10 +3973,12 @@ buf_zip_decompress(
<< ", crc32: "
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_CRC32)
+#ifdef INNODB_BUG_ENDIAN_CRC32
<< "/"
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_CRC32,
true)
+#endif
<< " innodb: "
<< page_zip_calc_checksum(
frame, size, SRV_CHECKSUM_ALGORITHM_INNODB)
diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc
index 74b182affbf..6c103c4f44b 100644
--- a/storage/innobase/buf/buf0checksum.cc
+++ b/storage/innobase/buf/buf0checksum.cc
@@ -39,44 +39,56 @@ ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to
'long unsigned int*' in initialization */
ulong srv_checksum_algorithm = SRV_CHECKSUM_ALGORITHM_INNODB;
-/** set if we have found pages matching legacy big endian checksum */
-bool legacy_big_endian_checksum = false;
-/** Calculates the CRC32 checksum of a page. The value is stored to the page
+#ifdef INNODB_BUG_ENDIAN_CRC32
+/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
-the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian
-variants. Note that we must be careful to calculate the same value on 32-bit
-and 64-bit architectures.
+the file. Note that we must be careful to calculate the same value on all
+architectures.
+@param[in] page buffer page (srv_page_size bytes)
+@param[in] bug_endian whether to use big endian byteorder
+when converting byte strings to integers, for bug-compatibility with
+big-endian architecture running MySQL 5.6, MariaDB 10.0 or MariaDB 10.1
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page, bool bug_endian)
+{
+ return bug_endian
+ ? ut_crc32_legacy_big_endian(
+ page + FIL_PAGE_OFFSET,
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ - FIL_PAGE_OFFSET)
+ ^ ut_crc32_legacy_big_endian(page + FIL_PAGE_DATA,
+ srv_page_size
+ - (FIL_PAGE_DATA
+ + FIL_PAGE_END_LSN_OLD_CHKSUM))
+ : ut_crc32(page + FIL_PAGE_OFFSET,
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ - FIL_PAGE_OFFSET)
+ ^ ut_crc32(page + FIL_PAGE_DATA,
+ srv_page_size
+ - (FIL_PAGE_DATA + FIL_PAGE_END_LSN_OLD_CHKSUM));
+}
+#else
+/** Calculate the CRC32 checksum of a page. The value is stored to the page
+when it is written to a file and also checked for a match when reading from
+the file. Note that we must be careful to calculate the same value on all
+architectures.
@param[in] page buffer page (srv_page_size bytes)
-@param[in] use_legacy_big_endian if true then use big endian
-byteorder when converting byte strings to integers
-@return checksum */
-uint32_t
-buf_calc_page_crc32(
- const byte* page,
- bool use_legacy_big_endian /* = false */)
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page)
{
- /* Since the field FIL_PAGE_FILE_FLUSH_LSN, and in versions <= 4.1.x
- FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, are written outside the buffer pool
- to the first pages of data files, we have to skip them in the page
- checksum calculation.
- We must also skip the field FIL_PAGE_SPACE_OR_CHKSUM where the
- checksum is stored, and also the last 8 bytes of page because
- there we store the old formula checksum. */
-
- ut_crc32_func_t crc32_func = use_legacy_big_endian
- ? ut_crc32_legacy_big_endian
- : ut_crc32;
-
- const uint32_t c1 = crc32_func(
- page + FIL_PAGE_OFFSET,
- FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION - FIL_PAGE_OFFSET);
-
- const uint32_t c2 = crc32_func(
- page + FIL_PAGE_DATA,
- srv_page_size - FIL_PAGE_DATA - FIL_PAGE_END_LSN_OLD_CHKSUM);
-
- return(c1 ^ c2);
+ /* Note: innodb_checksum_algorithm=crc32 could and should have
+ included the entire page in the checksum, and CRC-32 values
+ should be combined with the CRC-32 function, not with
+ exclusive OR. We stick to the current algorithm in order to
+ remain compatible with old data files. */
+ return ut_crc32(page + FIL_PAGE_OFFSET,
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ - FIL_PAGE_OFFSET)
+ ^ ut_crc32(page + FIL_PAGE_DATA,
+ srv_page_size
+ - (FIL_PAGE_DATA + FIL_PAGE_END_LSN_OLD_CHKSUM));
}
+#endif
/** Calculate a checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value on
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 727264573da..637cf6f6173 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -2615,7 +2615,7 @@ fil_space_verify_crypt_checksum(
uint32_t checksum1 = mach_read_from_4(page + FIL_PAGE_SPACE_OR_CHKSUM);
uint32_t checksum2;
- bool valid;
+ bool valid = false;
if (page_size.is_compressed()) {
valid = checksum1 == cchecksum1;
@@ -2623,12 +2623,32 @@ fil_space_verify_crypt_checksum(
} else {
checksum2 = mach_read_from_4(
page + srv_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM);
- valid = buf_page_is_checksum_valid_crc32(
- page, checksum1, checksum2, false
- /* FIXME: also try the original crc32 that was
- buggy on big-endian architectures? */)
- || buf_page_is_checksum_valid_innodb(
+
+ srv_checksum_algorithm_t algorithm =
+ static_cast<srv_checksum_algorithm_t>(
+ srv_checksum_algorithm);
+ switch (algorithm) {
+ 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:
+ case SRV_CHECKSUM_ALGORITHM_CRC32:
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ case SRV_CHECKSUM_ALGORITHM_NONE:
+ /* never supported
+ innodb_checksum_algorithm=none or strict_none
+ for encrypted pages. */
+ valid = buf_page_is_checksum_valid_crc32(
+ page, checksum1, checksum2)
+ || buf_page_is_checksum_valid_innodb(
+ page, checksum1, checksum2);
+ break;
+ }
}
if (encrypted && valid) {
@@ -2653,8 +2673,11 @@ fil_space_verify_crypt_checksum(
ib::info()
<< "If unencrypted: stored checksum [" << checksum1
<< ":" << checksum2 << "] calculated crc32 ["
- << buf_calc_page_crc32(page, false) << ":"
- << buf_calc_page_crc32(page, true) << "] innodb ["
+ << buf_calc_page_crc32(page)
+# ifdef INNODB_BUG_ENDIAN_CRC32
+ << ":" << buf_calc_page_crc32(page, true)
+# endif /* INNODB_BUG_ENDIAN_CRC32 */
+ << "] innodb ["
<< buf_calc_page_old_checksum(page) << ":"
<< buf_calc_page_new_checksum(page) << "] LSN "
<< mach_read_from_4(page + FIL_PAGE_LSN);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index f63ae9d82d7..b4eac793a3a 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1510,8 +1510,8 @@ fts_rename_one_aux_table(
table_new_name_len - new_db_name_len);
fts_table_new_name[table_new_name_len] = 0;
- return(row_rename_table_for_mysql(
- fts_table_old_name, fts_table_new_name, trx, false));
+ return row_rename_table_for_mysql(
+ fts_table_old_name, fts_table_new_name, trx, false, false);
}
/****************************************************************//**
@@ -6233,7 +6233,7 @@ fts_rename_one_aux_table_to_hex_format(
}
error = row_rename_table_for_mysql(aux_table->name, new_name, trx,
- FALSE);
+ false, false);
if (error != DB_SUCCESS) {
ib::warn() << "Failed to rename aux table '"
@@ -6372,7 +6372,7 @@ fts_rename_aux_tables_to_hex_format_low(
DICT_TF2_FLAG_UNSET(table, DICT_TF2_FTS_AUX_HEX_NAME);
err = row_rename_table_for_mysql(table->name.m_name,
aux_table->name,
- trx_bg, FALSE);
+ trx_bg, false, false);
trx_bg->dict_operation_lock_mode = 0;
dict_table_close(table, TRUE, FALSE);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index ba7a38c7428..d90088f2c5e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -5447,6 +5447,26 @@ normalize_table_name_c_low(
}
}
+create_table_info_t::create_table_info_t(
+ THD* thd,
+ TABLE* form,
+ HA_CREATE_INFO* create_info,
+ char* table_name,
+ char* remote_path,
+ bool file_per_table,
+ trx_t* trx)
+ : m_thd(thd),
+ m_trx(trx),
+ m_form(form),
+ m_default_row_format(innodb_default_row_format),
+ m_create_info(create_info),
+ m_table_name(table_name), m_table(NULL),
+ m_drop_before_rollback(false),
+ m_remote_path(remote_path),
+ m_innodb_file_per_table(file_per_table)
+{
+}
+
/** Normalizes a table name string.
A normalized name consists of the database name catenated to '/'
and table name. For example: test/mytable.
@@ -11072,9 +11092,6 @@ err_col:
case DB_SUCCESS:
ut_ad(table);
m_table = table;
- if (m_flags2 & DICT_TF2_FTS) {
- fts_optimize_add_table(table);
- }
DBUG_RETURN(0);
default:
break;
@@ -11093,7 +11110,8 @@ err_col:
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
}
- DBUG_RETURN(convert_error_code_to_mysql(err, m_flags, m_thd));}
+ DBUG_RETURN(convert_error_code_to_mysql(err, m_flags, m_thd));
+}
/*****************************************************************//**
Creates an index in an InnoDB database. */
@@ -11476,7 +11494,7 @@ Check engine specific table options not handled by SQL-parser.
const char*
create_table_info_t::check_table_options()
{
- enum row_type row_format = m_form->s->row_type;
+ enum row_type row_format = m_create_info->row_type;
ha_table_option_struct *options= m_form->s->option_struct;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
bool should_encrypt = (encrypt == FIL_ENCRYPTION_ON);
@@ -11523,7 +11541,16 @@ create_table_info_t::check_table_options()
return "PAGE_COMPRESSED";
}
- if (row_format == ROW_TYPE_REDUNDANT) {
+ switch (row_format) {
+ default:
+ break;
+ case ROW_TYPE_DEFAULT:
+ if (m_default_row_format
+ != DEFAULT_ROW_FORMAT_REDUNDANT) {
+ break;
+ }
+ /* fall through */
+ case ROW_TYPE_REDUNDANT:
push_warning(
m_thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
@@ -11729,9 +11756,9 @@ create_table_info_t::parse_table_name(
/** Determine InnoDB table flags.
If strict_mode=OFF, this will adjust the flags to what should be assumed.
-@retval true if successful, false if error */
-bool
-create_table_info_t::innobase_table_flags()
+@retval true on success
+@retval false on error */
+bool create_table_info_t::innobase_table_flags()
{
DBUG_ENTER("innobase_table_flags");
@@ -11739,7 +11766,7 @@ create_table_info_t::innobase_table_flags()
ulint zip_ssize = 0;
enum row_type row_type;
rec_format_t innodb_row_format =
- get_row_format(innodb_default_row_format);
+ get_row_format(m_default_row_format);
const bool is_temp
= m_create_info->options & HA_LEX_CREATE_TMP_TABLE;
bool zip_allowed
@@ -11840,7 +11867,7 @@ index_bad:
}
}
- row_type = m_form->s->row_type;
+ row_type = m_create_info->row_type;
if (zip_ssize && zip_allowed) {
/* if ROW_FORMAT is set to default,
@@ -12176,8 +12203,6 @@ create_table_info_t::initialize()
DBUG_RETURN(HA_ERR_WRONG_INDEX);
}
- ut_ad(m_form->s->row_type == m_create_info->row_type);
-
/* Get the transaction associated with the current thd, or create one
if not yet created */
@@ -12221,8 +12246,6 @@ int create_table_info_t::prepare_create_table(const char* name, bool strict)
ut_ad(m_thd != NULL);
ut_ad(m_create_info != NULL);
- ut_ad(m_form->s->row_type == m_create_info->row_type);
-
set_tablespace_type(false);
normalize_table_name(m_table_name, name);
@@ -12481,6 +12504,10 @@ create_table_info_t::create_table_update_dict()
trx_free(m_trx);
DBUG_RETURN(-1);
}
+
+ mutex_enter(&dict_sys->mutex);
+ fts_optimize_add_table(innobase_table);
+ mutex_exit(&dict_sys->mutex);
}
if (const Field* ai = m_form->found_next_number_field) {
@@ -13046,6 +13073,7 @@ innobase_drop_database(
@param[in] from old table name
@param[in] to new table name
@param[in] commit whether to commit trx
+@param[in] use_fk whether to parse and enforce FOREIGN KEY constraints
@return DB_SUCCESS or error code */
inline
dberr_t
@@ -13053,7 +13081,8 @@ innobase_rename_table(
trx_t* trx,
const char* from,
const char* to,
- bool commit = true)
+ bool commit,
+ bool use_fk)
{
dberr_t error;
char norm_to[FN_REFLEN];
@@ -13108,7 +13137,8 @@ innobase_rename_table(
goto func_exit;
}
- error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit);
+ error = row_rename_table_for_mysql(norm_from, norm_to, trx, commit,
+ use_fk);
if (error != DB_SUCCESS) {
if (error == DB_TABLE_NOT_FOUND
@@ -13133,7 +13163,8 @@ innobase_rename_table(
#endif /* _WIN32 */
trx_start_if_not_started(trx, true);
error = row_rename_table_for_mysql(
- par_case_name, norm_to, trx, TRUE);
+ par_case_name, norm_to, trx,
+ true, false);
}
}
@@ -13214,14 +13245,31 @@ int ha_innobase::truncate()
trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
row_mysql_lock_data_dictionary(trx);
int err = convert_error_code_to_mysql(
- innobase_rename_table(trx, ib_table->name.m_name, temp_name, false),
+ innobase_rename_table(trx, ib_table->name.m_name, temp_name,
+ false, false),
ib_table->flags, m_user_thd);
if (err) {
trx_rollback_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx);
} else {
+ switch (dict_tf_get_rec_format(ib_table->flags)) {
+ case REC_FORMAT_REDUNDANT:
+ info.row_type = ROW_TYPE_REDUNDANT;
+ break;
+ case REC_FORMAT_COMPACT:
+ info.row_type = ROW_TYPE_COMPACT;
+ break;
+ case REC_FORMAT_COMPRESSED:
+ info.row_type = ROW_TYPE_COMPRESSED;
+ break;
+ case REC_FORMAT_DYNAMIC:
+ info.row_type = ROW_TYPE_DYNAMIC;
+ break;
+ }
+
err = create(name, table, &info,
- dict_table_is_file_per_table(ib_table), trx);
+ ib_table->is_temporary()
+ || dict_table_is_file_per_table(ib_table), trx);
}
trx_free(trx);
@@ -13267,7 +13315,7 @@ ha_innobase::rename_table(
++trx->will_lock;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
- dberr_t error = innobase_rename_table(trx, from, to);
+ dberr_t error = innobase_rename_table(trx, from, to, true, true);
DEBUG_SYNC(thd, "after_innobase_rename_table");
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index ed7d380db8b..6f0c5b535fb 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -651,15 +651,7 @@ public:
char* table_name,
char* remote_path,
bool file_per_table,
- trx_t* trx = NULL)
- :m_thd(thd),
- m_trx(trx),
- m_form(form),
- m_create_info(create_info),
- m_table_name(table_name), m_table(NULL), m_drop_before_rollback(false),
- m_remote_path(remote_path),
- m_innodb_file_per_table(file_per_table)
- {}
+ trx_t* trx = NULL);
/** Initialize the object. */
int initialize();
@@ -768,6 +760,9 @@ private:
/** Information on table columns and indexes. */
const TABLE* m_form;
+ /** Value of innodb_default_row_format */
+ const ulong m_default_row_format;
+
/** Create options. */
HA_CREATE_INFO* m_create_info;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bc483ffa130..1e9e6dbda12 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -5018,8 +5018,10 @@ new_clustered_failed:
user_table, ctx->trx);
if (ctx->need_rebuild()) {
- ut_ad(!ctx->new_table->cached);
- dict_mem_table_free(ctx->new_table);
+ if (ctx->new_table) {
+ ut_ad(!ctx->new_table->cached);
+ dict_mem_table_free(ctx->new_table);
+ }
ctx->new_table = ctx->old_table;
}
@@ -5517,7 +5519,7 @@ not_instant_add_column:
break;
case DB_TABLESPACE_EXISTS:
my_error(ER_TABLESPACE_EXISTS, MYF(0),
- ctx->new_table->name.m_name);
+ altered_table->s->table_name.str);
goto new_table_failed;
case DB_DUPLICATE_KEY:
my_error(HA_ERR_TABLE_EXIST, MYF(0),
@@ -5525,12 +5527,13 @@ not_instant_add_column:
goto new_table_failed;
case DB_UNSUPPORTED:
my_error(ER_UNSUPPORTED_EXTENSION, MYF(0),
- ctx->new_table->name.m_name);
+ altered_table->s->table_name.str);
goto new_table_failed;
default:
my_error_innodb(error, table_name, flags);
new_table_failed:
DBUG_ASSERT(ctx->trx != ctx->prebuilt->trx);
+ ctx->new_table = NULL;
goto new_clustered_failed;
}
@@ -6460,9 +6463,8 @@ check_if_ok_to_rename:
/* Check each index's column length to make sure they do not
exceed limit */
- for (ulint i = 0; i < ha_alter_info->index_add_count; i++) {
- const KEY* key = &ha_alter_info->key_info_buffer[
- ha_alter_info->index_add_buffer[i]];
+ for (ulint i = 0; i < ha_alter_info->key_count; i++) {
+ const KEY* key = &ha_alter_info->key_info_buffer[i];
if (key->flags & HA_FULLTEXT) {
/* The column length does not matter for
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 8ca9ddd28fe..86a433d36e3 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -716,14 +716,12 @@ buf_block_unfix(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2,
- bool use_legacy_big_endian)
+ ulint checksum_field2)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
/** Checks if the page is in innodb checksum format.
diff --git a/storage/innobase/include/buf0checksum.h b/storage/innobase/include/buf0checksum.h
index 98c6ff16a6a..06eb37906d2 100644
--- a/storage/innobase/include/buf0checksum.h
+++ b/storage/innobase/include/buf0checksum.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -29,19 +29,26 @@ Created Aug 11, 2011 Vasil Dimov
#include "buf0types.h"
+#ifdef INNODB_BUG_ENDIAN_CRC32
/** Calculate the CRC32 checksum of a page. The value is stored to the page
when it is written to a file and also checked for a match when reading from
-the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian
-variants. Note that we must be careful to calculate the same value on 32-bit
-and 64-bit architectures.
+the file. Note that we must be careful to calculate the same value on all
+architectures.
+@param[in] page buffer page (srv_page_size bytes)
+@param[in] bug_endian whether to use big endian byteorder
+when converting byte strings to integers, for bug-compatibility with
+big-endian architecture running MySQL 5.6, MariaDB 10.0 or MariaDB 10.1
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page, bool bug_endian = false);
+#else
+/** Calculate the CRC32 checksum of a page. The value is stored to the page
+when it is written to a file and also checked for a match when reading from
+the file. Note that we must be careful to calculate the same value on all
+architectures.
@param[in] page buffer page (srv_page_size bytes)
-@param[in] use_legacy_big_endian if true then use big endian
-byteorder when converting byte strings to integers
-@return checksum */
-uint32_t
-buf_calc_page_crc32(
- const byte* page,
- bool use_legacy_big_endian = false);
+@return CRC-32C */
+uint32_t buf_calc_page_crc32(const byte* page);
+#endif
/** Calculate a checksum which is stored to the page when it is written
to a file. Note that we must be careful to calculate the same value on
@@ -69,6 +76,5 @@ const char*
buf_checksum_algorithm_name(srv_checksum_algorithm_t algo);
extern ulong srv_checksum_algorithm;
-extern bool legacy_big_endian_checksum;
#endif /* buf0checksum_h */
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 03b842e041d..78e16774a09 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -685,31 +685,30 @@ dict_tf_set(
bool page_compressed,
ulint page_compression_level)
{
+ *flags = use_data_dir ? 1 << DICT_TF_POS_DATA_DIR : 0;
+
switch (format) {
case REC_FORMAT_REDUNDANT:
- *flags = 0;
ut_ad(zip_ssize == 0);
- break;
+ /* no other options are allowed */
+ ut_ad(!page_compressed);
+ return;
case REC_FORMAT_COMPACT:
- *flags = DICT_TF_COMPACT;
+ *flags |= DICT_TF_COMPACT;
ut_ad(zip_ssize == 0);
break;
case REC_FORMAT_COMPRESSED:
- *flags = DICT_TF_COMPACT
+ *flags |= DICT_TF_COMPACT
| (1 << DICT_TF_POS_ATOMIC_BLOBS)
| (zip_ssize << DICT_TF_POS_ZIP_SSIZE);
break;
case REC_FORMAT_DYNAMIC:
- *flags = DICT_TF_COMPACT
+ *flags |= DICT_TF_COMPACT
| (1 << DICT_TF_POS_ATOMIC_BLOBS);
ut_ad(zip_ssize == 0);
break;
}
- if (use_data_dir) {
- *flags |= (1 << DICT_TF_POS_DATA_DIR);
- }
-
if (page_compressed) {
*flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS)
| (1 << DICT_TF_POS_PAGE_COMPRESSION)
diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.ic
index 486f8c2f109..1091e48a467 100644
--- a/storage/innobase/include/fts0types.ic
+++ b/storage/innobase/include/fts0types.ic
@@ -108,19 +108,21 @@ innobase_strnxfrm(
@param[in] cs charset
@retval true if the charset is cjk
@retval false if not. */
-UNIV_INLINE
-bool
-fts_is_charset_cjk(
- const CHARSET_INFO* cs)
+inline bool fts_is_charset_cjk(const CHARSET_INFO* cs)
{
- return cs == &my_charset_gb2312_chinese_ci
- || cs == &my_charset_gbk_chinese_ci
- || cs == &my_charset_big5_chinese_ci
- || cs == &my_charset_ujis_japanese_ci
- || cs == &my_charset_sjis_japanese_ci
- || cs == &my_charset_cp932_japanese_ci
- || cs == &my_charset_eucjpms_japanese_ci
- || cs == &my_charset_euckr_korean_ci;
+ switch (cs->number) {
+ case 24: /* my_charset_gb2312_chinese_ci */
+ case 28: /* my_charset_gbk_chinese_ci */
+ case 1: /* my_charset_big5_chinese_ci */
+ case 12: /* my_charset_ujis_japanese_ci */
+ case 13: /* my_charset_sjis_japanese_ci */
+ case 95: /* my_charset_cp932_japanese_ci */
+ case 97: /* my_charset_eucjpms_japanese_ci */
+ case 19: /* my_charset_euckr_korean_ci */
+ return true;
+ default:
+ return false;
+ }
}
/** Select the FTS auxiliary index for the given character by range.
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 0ff63f8047f..58115b767d2 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -1351,17 +1351,6 @@ const rec_t*
page_find_rec_max_not_deleted(
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
#undef UNIV_INLINE
#define UNIV_INLINE UNIV_INLINE_ORIGINAL
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index a2910a73634..bb9bb049c22 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -513,16 +513,17 @@ page_zip_parse_compress(
@param[in] data compressed page
@param[in] size size of compressed page
@param[in] algo algorithm to use
-@param[in] use_legacy_big_endian only used if algo is
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
@return page checksum */
uint32_t
page_zip_calc_checksum(
const void* data,
ulint size,
- srv_checksum_algorithm_t algo,
- bool use_legacy_big_endian = false);
+ srv_checksum_algorithm_t algo
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ /** for crc32, use the big-endian bug-compatible crc32 variant */
+ , bool use_legacy_big_endian = false
+#endif
+);
/**********************************************************************//**
Verify a compressed page's checksum.
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index fb385dbf2ac..56c254e1d45 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -483,7 +483,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: whether to commit trx */
+ bool commit, /*!< in: whether to commit trx */
+ bool use_fk) /*!< in: whether to parse and enforce
+ FOREIGN KEY constraints */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
diff --git a/storage/innobase/include/ut0crc32.h b/storage/innobase/include/ut0crc32.h
index 32ad066f85a..b8fc4168dfd 100644
--- a/storage/innobase/include/ut0crc32.h
+++ b/storage/innobase/include/ut0crc32.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
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
@@ -47,9 +47,11 @@ typedef uint32_t (*ut_crc32_func_t)(const byte* ptr, ulint len);
/** Pointer to CRC32 calculation function. */
extern ut_crc32_func_t ut_crc32;
-/** CRC32 calculation function, which uses big-endian byte order
+#ifdef INNODB_BUG_ENDIAN_CRC32
+/** Pointer to CRC32 calculation function, which uses big-endian byte order
when converting byte strings to integers internally. */
extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len);
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
/** Text description of CRC32 implementation */
extern const char* ut_crc32_implementation;
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index a728dd08c0d..33b73813b0e 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -25,6 +25,7 @@ INCLUDE(lzma.cmake)
INCLUDE(bzip2.cmake)
INCLUDE(snappy.cmake)
INCLUDE(numa)
+INCLUDE(TestBigEndian)
MYSQL_CHECK_LZ4()
MYSQL_CHECK_LZO()
@@ -32,6 +33,7 @@ MYSQL_CHECK_LZMA()
MYSQL_CHECK_BZIP2()
MYSQL_CHECK_SNAPPY()
MYSQL_CHECK_NUMA()
+TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
@@ -119,6 +121,11 @@ ELSEIF(WITH_INNODB_ROOT_GUESS)
ADD_DEFINITIONS(-DBTR_CUR_ADAPT)
ENDIF()
+OPTION(WITH_INNODB_BUG_ENDIAN_CRC32 "Weaken innodb_checksum_algorithm=crc32 by supporting upgrade from big-endian systems running 5.6/10.0/10.1" ${IS_BIG_ENDIAN})
+IF(WITH_INNODB_BUG_ENDIAN_CRC32)
+ ADD_DEFINITIONS(-DINNODB_BUG_ENDIAN_CRC32)
+ENDIF()
+
OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF)
IF(WITH_INNODB_EXTRA_DEBUG)
ADD_DEFINITIONS(-DUNIV_ZIP_DEBUG)
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 36a4cb46cf7..f56d944697f 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -2836,42 +2836,3 @@ page_find_rec_max_not_deleted(
}
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.";
-}
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 4b611baefae..05889b617bc 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -4980,18 +4980,17 @@ corrupt:
@param[in] data compressed page
@param[in] size size of compressed page
@param[in] algo algorithm to use
-@param[in] use_legacy_big_endian only used if algo is
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
-SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true
-then use big endian byteorder when converting byte strings to integers.
@return page checksum */
uint32_t
page_zip_calc_checksum(
const void* data,
ulint size,
- srv_checksum_algorithm_t algo,
- bool use_legacy_big_endian /* = false */)
+ srv_checksum_algorithm_t algo
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ /** for crc32, use the big-endian bug-compatible crc32 variant */
+ , bool use_legacy_big_endian
+#endif
+)
{
uLong adler;
const Bytef* s = static_cast<const byte*>(data);
@@ -5002,25 +5001,25 @@ page_zip_calc_checksum(
switch (algo) {
case SRV_CHECKSUM_ALGORITHM_CRC32:
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- {
- ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-
- ut_crc32_func_t crc32_func = use_legacy_big_endian
- ? ut_crc32_legacy_big_endian
- : ut_crc32;
-
- const uint32_t crc32
- = crc32_func(
- s + FIL_PAGE_OFFSET,
- FIL_PAGE_LSN - FIL_PAGE_OFFSET)
- ^ crc32_func(
+ ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ if (use_legacy_big_endian) {
+ return ut_crc32_legacy_big_endian(s + FIL_PAGE_OFFSET,
+ FIL_PAGE_LSN
+ - FIL_PAGE_OFFSET)
+ ^ ut_crc32_legacy_big_endian(
s + FIL_PAGE_TYPE, 2)
- ^ crc32_func(
+ ^ ut_crc32_legacy_big_endian(
s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
- size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-
- return(crc32);
+ size
+ - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
}
+#endif
+ return ut_crc32(s + FIL_PAGE_OFFSET,
+ FIL_PAGE_LSN - FIL_PAGE_OFFSET)
+ ^ ut_crc32(s + FIL_PAGE_TYPE, 2)
+ ^ ut_crc32(s + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
+ size - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
case SRV_CHECKSUM_ALGORITHM_INNODB:
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
ut_ad(size > FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
@@ -5055,19 +5054,8 @@ page_zip_verify_checksum(
const void* data, /*!< in: compressed page */
ulint size) /*!< in: size of compressed page */
{
- ib_uint32_t stored;
- ib_uint32_t calc;
-
- stored = static_cast<ib_uint32_t>(mach_read_from_4(
- 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);
+ const uint32_t stored = mach_read_from_4(
+ static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM);
compile_time_assert(!(FIL_PAGE_LSN % 8));
@@ -5109,8 +5097,7 @@ page_zip_verify_checksum(
return(TRUE);
}
- calc = static_cast<ib_uint32_t>(page_zip_calc_checksum(
- data, size, curr_algo));
+ uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
#ifdef UNIV_INNOCHECKSUM
if (log_file) {
@@ -5143,149 +5130,44 @@ page_zip_verify_checksum(
return(TRUE);
}
- bool legacy_checksum_checked = false;
-
switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
- case SRV_CHECKSUM_ALGORITHM_CRC32: {
-
- 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;
- return(TRUE);
- }
-
- break;
- }
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ return stored == page_zip_calc_checksum(data, size, curr_algo,
+ true);
+#endif
+ /* fall through */
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) {
-#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);
- }
-
- const uint32_t calculated = page_zip_calc_checksum(
- data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
- uint32_t calculated1;
-
- if (stored == calculated
- || stored == (calculated1 =
- page_zip_calc_checksum(data, size, SRV_CHECKSUM_ALGORITHM_CRC32, 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);
- }
-
- break;
- }
- case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: {
-
- 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);
+ return
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ stored == page_zip_calc_checksum(data, size, curr_algo,
+ true) ||
+#endif
+ stored == page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_INNODB);
+ case SRV_CHECKSUM_ALGORITHM_INNODB:
+ if (stored == BUF_NO_CHECKSUM_MAGIC) {
+ return TRUE;
}
- break;
- }
+ return stored == page_zip_calc_checksum(
+ data, size, SRV_CHECKSUM_ALGORITHM_CRC32)
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ || stored == page_zip_calc_checksum(
+ data, size,
+ SRV_CHECKSUM_ALGORITHM_CRC32, true)
+#endif
+ ;
case SRV_CHECKSUM_ALGORITHM_NONE:
- ut_error;
- /* no default so the compiler will emit a warning if new enum
- is added and not handled here */
+ return TRUE;
}
- return(FALSE);
+ return FALSE;
}
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index f46c381fbf7..941b7798c39 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1579,9 +1579,6 @@ row_fts_merge_insert(
dict_table_t* aux_table;
dict_index_t* aux_index;
trx_t* trx;
- byte trx_id_buf[6];
- roll_ptr_t roll_ptr = 0;
- dfield_t* field;
ut_ad(index);
ut_ad(table);
@@ -1692,16 +1689,13 @@ row_fts_merge_insert(
dict_index_get_n_fields(aux_index));
/* Set TRX_ID and ROLL_PTR */
- trx_write_trx_id(trx_id_buf, trx->id);
- field = dtuple_get_nth_field(ins_ctx.tuple, 2);
- dfield_set_data(field, &trx_id_buf, 6);
+ dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 2),
+ &reset_trx_id, DATA_TRX_ID_LEN);
+ dfield_set_data(dtuple_get_nth_field(ins_ctx.tuple, 3),
+ &reset_trx_id[DATA_TRX_ID_LEN], DATA_ROLL_PTR_LEN);
- field = dtuple_get_nth_field(ins_ctx.tuple, 3);
- dfield_set_data(field, &roll_ptr, 7);
+ ut_d(ins_ctx.aux_index_id = id);
-#ifdef UNIV_DEBUG
- ins_ctx.aux_index_id = id;
-#endif
const ulint space = table->space_id;
for (i = 0; i < fts_sort_pll_degree; i++) {
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 757a9ff232a..5b69663b0db 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -3519,7 +3519,8 @@ defer:
ib::info() << "Deferring DROP TABLE " << table->name
<< "; renaming to " << tmp_name;
err = row_rename_table_for_mysql(
- table->name.m_name, tmp_name, trx, false);
+ table->name.m_name, tmp_name, trx,
+ false, false);
} else {
err = DB_SUCCESS;
}
@@ -4144,7 +4145,9 @@ row_rename_table_for_mysql(
const char* old_name, /*!< in: old table name */
const char* new_name, /*!< in: new table name */
trx_t* trx, /*!< in/out: transaction */
- bool commit) /*!< in: whether to commit trx */
+ bool commit, /*!< in: whether to commit trx */
+ bool use_fk) /*!< in: whether to parse and enforce
+ FOREIGN KEY constraints */
{
dict_table_t* table = NULL;
ibool dict_locked = FALSE;
@@ -4248,7 +4251,7 @@ row_rename_table_for_mysql(
goto funct_exit;
- } else if (!old_is_tmp && new_is_tmp) {
+ } else if (use_fk && !old_is_tmp && new_is_tmp) {
/* MySQL is doing an ALTER TABLE command and it renames the
original table to a temporary table name. We want to preserve
the original foreign key constraint definitions despite the
diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc
index 5d95202b7c9..0b1c1b3991a 100644
--- a/storage/innobase/ut/ut0crc32.cc
+++ b/storage/innobase/ut/ut0crc32.cc
@@ -2,7 +2,7 @@
Copyright (c) 2009, 2010 Facebook, Inc. All Rights Reserved.
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2018, MariaDB Corporation.
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
@@ -469,6 +469,7 @@ ut_crc32_64_sw(
*len -= 8;
}
+#ifdef INNODB_BUG_ENDIAN_CRC32
/** Calculate CRC32 over 64-bit byte string using a software implementation.
The byte string is converted to a 64-bit integer using big endian byte order.
@param[in,out] crc crc32 checksum so far when this function is called,
@@ -494,6 +495,7 @@ ut_crc32_64_legacy_big_endian_sw(
*data += 8;
*len -= 8;
}
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
/** Calculates CRC32 in software, without using CPU instructions.
@param[in] buf data over which to calculate CRC32
@@ -545,16 +547,14 @@ ut_crc32_sw(
return(~crc);
}
+#ifdef INNODB_BUG_ENDIAN_CRC32
/** Calculates CRC32 in software, without using CPU instructions.
This function uses big endian byte ordering when converting byte sequence to
integers.
@param[in] buf data over which to calculate CRC32
@param[in] len data length
@return CRC-32C (polynomial 0x11EDC6F41) */
-uint32_t
-ut_crc32_legacy_big_endian(
- const byte* buf,
- ulint len)
+uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len)
{
uint32_t crc = 0xFFFFFFFFU;
@@ -596,6 +596,7 @@ ut_crc32_legacy_big_endian(
return(~crc);
}
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
/********************************************************************//**
Initializes the data structures used by ut_crc32*(). Does not do any
@@ -636,6 +637,9 @@ ut_crc32_init()
if (features_ecx & 1 << 20) {
ut_crc32 = ut_crc32_hw;
+#ifdef INNODB_BUG_ENDIAN_CRC32
+ ut_crc32_legacy_big_endian = ut_crc32_legacy_big_endian_hw;
+#endif /* INNODB_BUG_ENDIAN_CRC32 */
ut_crc32_implementation = "Using SSE2 crc32 instructions";
}
#endif
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index cbf3dad0965..08fd003a919 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -20305,8 +20305,67 @@ static void test_bulk_autoinc()
myquery(rc);
}
-#endif
+static void test_bulk_delete()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind[1];
+ MYSQL_ROW row;
+ char indicator[]= {0, 0, 0};
+ my_bool error[1];
+ int i, id[]= {1, 2, 4}, count= sizeof(id)/sizeof(id[0]);
+ MYSQL_RES *result;
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1 (id int not null primary key)");
+ myquery(rc);
+ rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1),(2),(3),(4)");
+ myquery(rc);
+ verify_affected_rows(4);
+
+ stmt= mysql_stmt_init(mysql);
+ rc= mysql_stmt_prepare(stmt, "DELETE FROM t1 where id=?", -1);
+ check_execute(stmt, rc);
+
+ memset(bind, 0, sizeof(bind));
+ bind[0].buffer_type = MYSQL_TYPE_LONG;
+ bind[0].buffer = (void *)id;
+ bind[0].buffer_length = 0;
+ bind[0].is_null = NULL;
+ bind[0].length = NULL;
+ bind[0].error = error;
+ bind[0].u.indicator= indicator;
+ mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, (void*)&count);
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ verify_affected_rows(3);
+
+ mysql_stmt_close(stmt);
+
+ rc= mysql_query(mysql, "SELECT id FROM t1");
+ myquery(rc);
+
+ result= mysql_store_result(mysql);
+ mytest(result);
+
+ i= 0;
+ while ((row= mysql_fetch_row(result)))
+ {
+ i++;
+ DIE_IF(atoi(row[0]) != 3);
+ }
+ DIE_IF(i != 1);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+}
+
+#endif
static void print_metadata(MYSQL_RES *rs_metadata, int num_fields)
{
@@ -20915,6 +20974,7 @@ static struct my_tests_st my_tests[]= {
#ifndef EMBEDDED_LIBRARY
{ "test_proxy_header", test_proxy_header},
{ "test_bulk_autoinc", test_bulk_autoinc},
+ { "test_bulk_delete", test_bulk_delete },
#endif
{ "test_explain_meta", test_explain_meta },
{ 0, 0 }