From c4c48e974013a1a3d62ae6b2fc9a705c3bdd1689 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 7 Mar 2017 19:21:42 +0100 Subject: [PATCH 1/7] MDEV-11965 -Werror should not appear in released tarballs --- .../tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake index 769bdffa5d9..c17e119d1cd 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake @@ -196,9 +196,9 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) set_cflags_if_supported(-Wcast-align) endif () -## always want these -set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") -set(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}") +## always want these in debug builds +set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror ${CMAKE_C_FLAGS_DEBUG}") +set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror ${CMAKE_CXX_FLAGS_DEBUG}") # pick language dialect set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}") From 04daf30e9bca85b3241981c53f2293cee1f2de00 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Fri, 3 Nov 2017 17:05:41 +0400 Subject: [PATCH 2/7] MDEV-13921 Audit log writes invalid SQL if single-line comments are present. Escape special characters (like \r \n \t) instead of replacing them with spaces. --- .../suite/plugins/r/server_audit.result | 9 +++-- mysql-test/suite/plugins/t/server_audit.test | 5 ++- plugin/server_audit/server_audit.c | 39 ++++++++++--------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index ceb75176b43..3971504b238 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -47,6 +47,7 @@ alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; select 1, 2, +# comment 3; 1 2 3 1 2 3 @@ -161,7 +162,9 @@ id 2 CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; -SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD +# comment +FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1=; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 CREATE USER u3 IDENTIFIED BY ''; @@ -253,7 +256,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1,\n2,\n# comment\n3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID @@ -336,7 +339,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD \n# comment\nFOR u1 = PASSWORD(*****)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=',ID TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 52428909c3b..9be0d5556f0 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -38,6 +38,7 @@ alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; select 1, 2, +# comment 3; insert into t2 values (1), (2); select * from t2; @@ -106,7 +107,9 @@ insert into t1 values (1), (2); select * from t1; CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; -SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD +# comment +FOR u1 = PASSWORD('pwd 098'); --error 1064 SET PASSWORD FOR u1=; CREATE USER u3 IDENTIFIED BY ''; diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 6a2ed16cb00..152cc75b710 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -1121,6 +1121,21 @@ do { \ } while(0) +#define ESC_MAP_SIZE 0x60 +static const char esc_map[ESC_MAP_SIZE]= +{ + 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, '\'', 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '\\', 0, 0, 0 +}; + +static char escaped_char(char c) +{ + return ((unsigned char ) c) >= ESC_MAP_SIZE ? 0 : esc_map[(unsigned char) c]; +} static void setup_connection_initdb(struct connection_info *cn, @@ -1327,21 +1342,16 @@ static size_t escape_string(const char *str, unsigned int len, const char *res_end= result + result_len - 2; while (len) { + char esc_c; + if (result >= res_end) break; - if (*str == '\'') + if ((esc_c= escaped_char(*str))) { if (result+1 >= res_end) break; *(result++)= '\\'; - *(result++)= '\''; - } - else if (*str == '\\') - { - if (result+1 >= res_end) - break; - *(result++)= '\\'; - *(result++)= '\\'; + *(result++)= esc_c; } else if (is_space(*str)) *(result++)= ' '; @@ -1430,19 +1440,12 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len, no_password: if (result >= res_end) break; - if (*str == '\'') + if ((b_char= escaped_char(*str))) { if (result+1 >= res_end) break; *(result++)= '\\'; - *(result++)= '\''; - } - else if (*str == '\\') - { - if (result+1 >= res_end) - break; - *(result++)= '\\'; - *(result++)= '\\'; + *(result++)= b_char; } else if (is_space(*str)) *(result++)= ' '; From 1394ea696565bdf67ba2a9ef8caca79a22f5787e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Fri, 3 Nov 2017 22:36:58 +0400 Subject: [PATCH 3/7] MDEV-13921 Audit log writes invalid SQL if single-line comments are present. thread_pool_server_audit.test fixed. plugin version updated. --- .../suite/plugins/r/thread_pool_server_audit.result | 9 ++++++--- mysql-test/suite/plugins/t/thread_pool_server_audit.test | 5 ++++- plugin/server_audit/server_audit.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/plugins/r/thread_pool_server_audit.result b/mysql-test/suite/plugins/r/thread_pool_server_audit.result index ceb75176b43..912cef2761a 100644 --- a/mysql-test/suite/plugins/r/thread_pool_server_audit.result +++ b/mysql-test/suite/plugins/r/thread_pool_server_audit.result @@ -47,6 +47,7 @@ alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; select 1, 2, +# comment 3; 1 2 3 1 2 3 @@ -161,7 +162,9 @@ id 2 CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; -SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD +# comment +FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1=; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 CREATE USER u3 IDENTIFIED BY ''; @@ -253,7 +256,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,index_stats, TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1,\n2,\n# comment\n3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID @@ -336,7 +339,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*! select 2*/',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'/*comment*/ select 2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u1 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'GRANT ALL ON sa_db TO u2 IDENTIFIED BY *****',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1 = PASSWORD(*****)',0 +TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD\n# comment\nFOR u1 = PASSWORD(*****)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=',ID TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 diff --git a/mysql-test/suite/plugins/t/thread_pool_server_audit.test b/mysql-test/suite/plugins/t/thread_pool_server_audit.test index 626d4136c47..724000c9789 100644 --- a/mysql-test/suite/plugins/t/thread_pool_server_audit.test +++ b/mysql-test/suite/plugins/t/thread_pool_server_audit.test @@ -38,6 +38,7 @@ alter table t1 rename renamed_t1; set global server_audit_events='connect,query'; select 1, 2, +# comment 3; insert into t2 values (1), (2); select * from t2; @@ -106,7 +107,9 @@ insert into t1 values (1), (2); select * from t1; CREATE USER u1 IDENTIFIED BY 'pwd-123'; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; -SET PASSWORD FOR u1 = PASSWORD('pwd 098'); +SET PASSWORD +# comment +FOR u1 = PASSWORD('pwd 098'); --error 1064 SET PASSWORD FOR u1=; CREATE USER u3 IDENTIFIED BY ''; diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 152cc75b710..323179d5f84 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -15,7 +15,7 @@ #define PLUGIN_VERSION 0x104 -#define PLUGIN_STR_VERSION "1.4.2" +#define PLUGIN_STR_VERSION "1.4.3" #define _my_thread_var loc_thread_var From 0ed5c09b28163726977ffc1754decda200b2beff Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Wed, 1 Nov 2017 19:57:47 +0200 Subject: [PATCH 4/7] MDEV-11864 main.view test uses CHECK PARTITION but does not check for the partition plugin The test would pass even with skipped partitioning, because CHECK PARTITION for a view works identically with enabled/disabled partitioning; but if the server is compiled without partitioning at all, it cannot execute the statement, and the test would fail. Check for the presence of partitioning allows to skip the test in this case, rather than let it fail --- mysql-test/t/view.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index cbccbb5d656..1d199c3bac5 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1,3 +1,4 @@ +--source include/have_partition.inc --disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t9,`t1a``b`,v1,v2,v3,v4,v5,v6; From 5e5adfa7293d2b8d981cbce6ef3fede3daf5b7a5 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Wed, 1 Nov 2017 18:40:09 +0200 Subject: [PATCH 5/7] MDEV-14029 Server does not remove #sql*.frm files after crash during ALTER TABLE Add a check for #sql* files in test and mysql subdirs to the testcase check --- mysql-test/include/check-testcase.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index dcf6bd154ce..3a9ec419bb1 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -73,5 +73,10 @@ if (!$tmp) { } call mtr.check_testcase(); + +let $datadir=`select @@datadir`; +list_files $datadir/test #sql*; +list_files $datadir/mysql #sql*; + --enable_query_log From bfde65c0ae09800b45748a153f6179f3ef3b64fa Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sat, 4 Nov 2017 02:39:16 +0200 Subject: [PATCH 6/7] MDEV-10651, MDEV-14196 sys_vars.innodb_buffer_pool_* tests fail - innodb_buffer_pool_dump_now_basic is modified to make sure it really performs a dump and waits till it completion, to avoid the apparent or hidden failure similar to MDEV-9713 / MDEV-10651 - innodb_buffer_pool_dump_pct_basic is modified to re-use the new code from innodb_buffer_pool_dump_now_basic and thus avoid the failure MDEV-10651 - innodb_buffer_pool_load_now_basic is re-written to simplify the logic by re-using the code innodb_buffer_pool_dump_now_basic and is given an opt file to avoid race conditions with buffer pool load performed upon server startup, which causes MDEV-14196 failure --- .../innodb_buffer_pool_dump_now_basic.result | 7 +-- .../innodb_buffer_pool_dump_pct_basic.result | 3 +- .../innodb_buffer_pool_load_now_basic.result | 6 +-- .../t/innodb_buffer_pool_dump_now_basic.test | 31 +++++++++++-- .../t/innodb_buffer_pool_dump_pct_basic.test | 18 +++----- .../t/innodb_buffer_pool_load_now_basic.opt | 1 + .../t/innodb_buffer_pool_load_now_basic.test | 44 +++++-------------- 7 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_now_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_now_basic.result index 9c3a37f892b..522d5731a6d 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_now_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_now_basic.result @@ -1,7 +1,8 @@ -SET @orig = @@global.innodb_buffer_pool_dump_now; -SELECT @orig; -@orig +SELECT @@global.innodb_buffer_pool_dump_now; +@@global.innodb_buffer_pool_dump_now 0 +SELECT variable_value INTO @old_dump_status FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; SET GLOBAL innodb_buffer_pool_dump_now = ON; SELECT @@global.innodb_buffer_pool_dump_now; @@global.innodb_buffer_pool_dump_now diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result index 51c72cfe791..70fcdd3cb56 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_dump_pct_basic.result @@ -2,7 +2,8 @@ SET @orig = @@global.innodb_buffer_pool_dump_pct; SELECT @orig; @orig 100 -SET GLOBAL innodb_buffer_pool_dump_pct=3, GLOBAL innodb_buffer_pool_dump_now = ON; +SET GLOBAL innodb_buffer_pool_dump_pct=3; +# Do the dump SET GLOBAL innodb_buffer_pool_dump_pct=0; SELECT @@global.innodb_buffer_pool_dump_pct; @@global.innodb_buffer_pool_dump_pct diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result index 3185d1ca170..eebed4d0f4a 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result @@ -1,8 +1,6 @@ -SET @orig = @@global.innodb_buffer_pool_load_now; -SELECT @orig; -@orig +SELECT @@global.innodb_buffer_pool_load_now; +@@global.innodb_buffer_pool_load_now 0 -SET GLOBAL innodb_buffer_pool_dump_now = ON; SET GLOBAL innodb_buffer_pool_load_now = ON; SELECT variable_value FROM information_schema.global_status diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test index 0bae347428e..8c5f8fa7bf0 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test @@ -5,8 +5,31 @@ -- source include/have_innodb.inc # Check the default value -SET @orig = @@global.innodb_buffer_pool_dump_now; -SELECT @orig; +SELECT @@global.innodb_buffer_pool_dump_now; + +-- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` +-- error 0,1 +-- remove_file $file + +SELECT variable_value INTO @old_dump_status FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; + +# A previous test could have run buffer pool dump already; +# in this case we want to make sure that the current time is different +# from the timestamp in the status variable. +# We should have had a smart wait condition here, like the commented one below, +# let $wait_condition = +# SELECT TRIM(SUBSTR('$old_status', -8)) != DATE_FORMAT(CURTIME(), '%k:%i:%s'); +# -- source include/wait_condition.inc + +# ... but we can't because of MDEV-9867, so there will be just sleep instead. +# And it might be not enough to sleep one second, so we'll have to sleep two. + +if (`SELECT variable_value LIKE '%completed at%' FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'`) +{ + -- sleep 2 +} # Do the dump SET GLOBAL innodb_buffer_pool_dump_now = ON; @@ -15,11 +38,11 @@ SELECT @@global.innodb_buffer_pool_dump_now; # Wait for the dump to complete let $wait_condition = - SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' + SELECT variable_value != @old_dump_status + AND SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; -- source include/wait_condition.inc # Confirm that the dump file has been created --- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` -- file_exists $file diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test index d2f5cb4a0de..1cf6775e06d 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_pct_basic.test @@ -8,19 +8,15 @@ SET @orig = @@global.innodb_buffer_pool_dump_pct; SELECT @orig; -# Do the dump -SET GLOBAL innodb_buffer_pool_dump_pct=3, GLOBAL innodb_buffer_pool_dump_now = ON; +SET GLOBAL innodb_buffer_pool_dump_pct=3; -# Wait for the dump to complete -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; --- source include/wait_condition.inc +--echo # Do the dump -# Confirm that the dump file has been created --- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` --- file_exists $file +--disable_query_log +--disable_result_log +--source innodb_buffer_pool_dump_now_basic.test +--enable_result_log +--enable_query_log --disable_warnings SET GLOBAL innodb_buffer_pool_dump_pct=0; diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt new file mode 100644 index 00000000000..e462be3c368 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-load-at-startup=off diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test index a0409901865..abb78ce5260 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test @@ -5,42 +5,22 @@ -- source include/have_innodb.inc # Check the default value -SET @orig = @@global.innodb_buffer_pool_load_now; -SELECT @orig; +SELECT @@global.innodb_buffer_pool_load_now; -let $old_status= `SELECT variable_value FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'`; +# Make sure there is a dump file to load -# A previous test could have run buffer pool dump already; -# in this case we want to make sure that the current time is different -# from the timestamp in the status variable. -# We should have had a smart wait condition here, like the commented one below, -# but we can't because of MDEV-9867, so there will be just sleep instead. -# And it might be not enough to sleep one second, so we'll have to sleep two. -# let $wait_condition = -# SELECT TRIM(SUBSTR('$old_status', -8)) != DATE_FORMAT(CURTIME(), '%k:%i:%s'); -# -- source include/wait_condition.inc - -if (`SELECT variable_value LIKE '%dump completed at%' FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'`) -{ - -- sleep 2 -} - -# Do the dump -SET GLOBAL innodb_buffer_pool_dump_now = ON; - -# Wait for the dump to complete -let $wait_condition = - SELECT variable_value != '$old_status' - AND SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; --- source include/wait_condition.inc - -# Confirm the file is really created -- let $file = `SELECT CONCAT(@@datadir, @@global.innodb_buffer_pool_filename)` +-- error 0,1 -- file_exists $file +if ($errno) +{ + # Dump file does not exist, get it created + --disable_query_log + --disable_result_log + --source innodb_buffer_pool_dump_now_basic.test + --enable_result_log + --enable_query_log +} # Load the dump SET GLOBAL innodb_buffer_pool_load_now = ON; From 6a524fcfdde539c6448aa4126ccb5ed79055b9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 6 Nov 2017 14:55:34 +0200 Subject: [PATCH 7/7] MDEV-14140 IMPORT TABLESPACE must not go beyond FSP_FREE_LIMIT ibuf_check_bitmap_on_import(): Only access the pages that are below FSP_FREE_LIMIT. It is possible that especially with ROW_FORMAT=COMPRESSED, the FSP_SIZE will be much bigger than the FSP_FREE_LIMIT, and the bitmap pages (page_size*N, 1+page_size*N) are filled with zero bytes. buf_page_is_corrupted(), buf_page_io_complete(): Make the fault injection compatible with MariaDB 10.2. Backport the IMPORT tests from 10.2. --- .../suite/innodb/r/innodb-wl5522-debug.result | 134 +++++------- .../suite/innodb/t/innodb-wl5522-debug.test | 204 +++++++----------- .../r/wl5522_debug_zip.result} | 95 ++++---- .../t/wl5522_debug_zip.test} | 176 +++++++-------- storage/innobase/buf/buf0buf.cc | 8 +- storage/innobase/ibuf/ibuf0ibuf.cc | 16 +- storage/xtradb/buf/buf0buf.cc | 8 +- storage/xtradb/ibuf/ibuf0ibuf.cc | 16 +- 8 files changed, 298 insertions(+), 359 deletions(-) rename mysql-test/suite/{innodb/r/innodb-wl5522-debug-zip.result => innodb_zip/r/wl5522_debug_zip.result} (86%) rename mysql-test/suite/{innodb/t/innodb-wl5522-debug-zip.test => innodb_zip/t/wl5522_debug_zip.test} (79%) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 0c914ebc7a6..43958f60578 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -1,33 +1,19 @@ SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -DROP DATABASE IF EXISTS test_wl5522; -Warnings: -Note 1008 Can't drop database 'test_wl5522'; database doesn't exist CREATE DATABASE test_wl5522; +CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug_dbug="-d,ib_discard_before_commit_crash"; DROP TABLE test_wl5522.t1; SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 +CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug_dbug="-d,ib_discard_after_commit_crash"; DROP TABLE test_wl5522.t1; SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); FLUSH TABLES test_wl5522.t1 FOR EXPORT; @@ -40,21 +26,18 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; SELECT * FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' +SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug_dbug="-d,ib_import_before_commit_crash"; -SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' +SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query unlink: t1.ibd unlink: t1.cfg -# Restart and reconnect to the server -SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash"; DROP TABLE test_wl5522.t1; SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; @@ -83,13 +66,14 @@ c1 DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); +SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; FLUSH TABLES test_wl5522.t1 FOR EXPORT; Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -99,7 +83,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -109,7 +93,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -119,7 +103,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -129,7 +113,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -139,7 +123,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -149,7 +133,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -159,7 +143,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -169,7 +153,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -179,7 +163,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_10"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -189,7 +173,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_11"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -199,7 +183,7 @@ Warnings: Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flush() failed Warning 1811 IO Write error: (9, Bad file descriptor) t1.cfg flose() failed UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_12"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (100), (200), (300); @@ -219,7 +203,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_1"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading index fields. -SET SESSION debug_dbug="-d,ib_import_io_read_error_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -230,7 +214,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_2"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes -SET SESSION debug_dbug="-d,ib_import_io_read_error_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -241,7 +225,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_3"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading number of indexes. -SET SESSION debug_dbug="-d,ib_import_io_read_error_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -252,7 +236,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_4"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading table column meta-data. -SET SESSION debug_dbug="-d,ib_import_io_read_error_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -263,7 +247,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_5"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data export hostname length. -SET SESSION debug_dbug="-d,ib_import_io_read_error_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -274,7 +258,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_6"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data table name length. -SET SESSION debug_dbug="-d,ib_import_io_read_error_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -285,7 +269,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_7"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading autoinc value. -SET SESSION debug_dbug="-d,ib_import_io_read_error_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -296,7 +280,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_8"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data header. -SET SESSION debug_dbug="-d,ib_import_io_read_error_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -307,7 +291,7 @@ SET SESSION debug_dbug="+d,ib_import_io_read_error_9"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while reading meta-data version. -SET SESSION debug_dbug="-d,ib_import_io_read_error_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -318,7 +302,7 @@ SET SESSION debug_dbug="+d,ib_import_string_read_error"; restore: t1 .cfg file ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: IO Read error: while parsing export hostname. -SET SESSION debug_dbug="-d,ib_import_string_read_error"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); @@ -329,7 +313,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_1"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -342,7 +326,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_2"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -355,7 +339,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_4"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -368,7 +352,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_5"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -381,7 +365,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_6"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -394,7 +378,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_7"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -407,7 +391,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_8"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -420,7 +404,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_9"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -433,7 +417,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_OOM_10"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET SESSION debug_dbug="-d,ib_import_OOM_10"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -445,7 +429,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_internal_error"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: While updating the of index "GEN_CLUST_INDEX" - Generic error -SET SESSION debug_dbug="-d,ib_import_internal_error"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; DROP TABLE test_wl5522.t1; @@ -458,36 +442,36 @@ SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Too many concurrent transactions restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd -SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_cluster_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; unlink: t1.ibd unlink: t1.cfg DROP TABLE test_wl5522.t1; @@ -499,7 +483,7 @@ c4 VARCHAR(2048), INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB; -SET GLOBAL INNODB_PURGE_STOP_NOW=ON; +START TRANSACTION WITH CONSISTENT SNAPSHOT; SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; @@ -664,7 +648,7 @@ FROM information_schema.innodb_metrics WHERE name = 'ibuf_merges_inserts' AND count > 0; name SET GLOBAL innodb_disable_background_merge=OFF; -SET GLOBAL INNODB_PURGE_RUN_NOW=ON; +COMMIT; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -800,8 +784,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=latin1 DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES -(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); +INSERT IGNORE INTO test_wl5522.t1 VALUES +(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731)); Warnings: Warning 1265 Data truncated for column 'c2' at row 1 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; @@ -827,7 +811,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -836,10 +820,10 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption -SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -851,7 +835,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index "GEN_CLUST_INDEX" -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -863,7 +847,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -875,7 +859,7 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); Warnings: Warning 1814 Tablespace has been discarded for table 't1' -SET SESSION debug_dbug="-d,ib_import_create_index_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -887,7 +871,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fil_space_create_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd -SET SESSION debug_dbug="-d,fil_space_create_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -899,7 +883,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd -SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -911,7 +895,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Unsupported -SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test index 9c0c11fadab..e7bc705b89a 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test @@ -1,4 +1,4 @@ -# Not supported in embedded +# mysql-test-run.pl --embedded cannot restart the server. --source include/not_embedded.inc # Adding big test option for this test. @@ -21,58 +21,39 @@ let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/; let $strerrfix=/ (\(.+\))//; SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -DROP DATABASE IF EXISTS test_wl5522; CREATE DATABASE test_wl5522; -##### Before DISCARD commit crash +CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; +INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); + +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect + +--exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_before_commit_crash"; +--error 2013 +ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; + +--source include/start_mysqld.inc + +DROP TABLE test_wl5522.t1; + +SET GLOBAL innodb_file_per_table = 1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); -# Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - -# Execute the statement that causes the crash ---error 2013 -ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; - ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect - -SET SESSION debug_dbug="-d,ib_discard_before_commit_crash"; -DROP TABLE test_wl5522.t1; -#### Before DISCARD commit crash - -##### After DISCARD commit crash -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; - +--exec echo wait > $_expect_file_name SET SESSION debug_dbug="+d,ib_discard_after_commit_crash"; - -CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; -INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); - -# Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - -# Execute the statement that causes the crash --error 2013 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect +--source include/start_mysqld.inc -SET SESSION debug_dbug="-d,ib_discard_after_commit_crash"; DROP TABLE test_wl5522.t1; -#### After DISCARD commit crash SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; # Create the table that we will use for crash recovery (during IMPORT) CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; @@ -104,61 +85,35 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF -##### Before commit crash -SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; - --error ER_TABLESPACE_DISCARDED SELECT * FROM test_wl5522.t1; -# Write file to make mysql-test-run.pl start up the server again ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - -# Execute the statement that causes the crash +--exec echo wait > $_expect_file_name +SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; --error 2013 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ---enable_reconnect ---source include/wait_until_connected_again.inc ---disable_reconnect - -SET SESSION debug_dbug="-d,ib_import_before_commit_crash"; -#### Before commit crash +--source include/start_mysqld.inc # Check that the DD is consistent after recovery -##### Before checkpoint crash -SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; - --error ER_TABLESPACE_DISCARDED SELECT COUNT(*) FROM test_wl5522.t1; -# Don't start up the server right away. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect - -# Execute the statement that causes the crash +--exec echo wait > $_expect_file_name +SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; --error 2013 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; # After the above test the results are non-deterministic, # delete the old tablespace files and drop the table, # recreate the table and do a proper import. --- source include/wait_until_disconnected.inc perl; do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF ---echo # Restart and reconnect to the server ---enable_reconnect ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---source include/wait_until_connected_again.inc ---disable_reconnect - -SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash"; -#### Before checkpoint crash - -# After the above test the results are non-deterministic, recreate the table -# and do a proper import. +--source include/start_mysqld.inc DROP TABLE test_wl5522.t1; @@ -190,6 +145,7 @@ DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; INSERT INTO test_wl5522.t1 VALUES (1); +SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_export_io_write_failure_1"; --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ @@ -198,7 +154,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -214,7 +170,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -229,7 +185,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -244,7 +200,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -259,7 +215,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -275,7 +231,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -291,7 +247,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -307,7 +263,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -322,7 +278,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -338,7 +294,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_10"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -354,7 +310,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_11"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -370,7 +326,7 @@ FLUSH TABLES test_wl5522.t1 FOR EXPORT; UNLOCK TABLES; -SET SESSION debug_dbug="-d,ib_export_io_write_failure_12"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -410,7 +366,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -434,7 +390,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -458,7 +414,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -482,7 +438,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -506,7 +462,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -530,7 +486,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -554,7 +510,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -578,7 +534,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -602,7 +558,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_io_read_error_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -627,7 +583,7 @@ EOF --error ER_IO_READ_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_string_read_error"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -654,7 +610,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_1"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -686,7 +642,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_2"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -718,7 +674,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_4"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_4"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -750,7 +706,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_5"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_5"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -781,7 +737,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_6"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_6"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -811,7 +767,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_7"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_7"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -841,7 +797,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_8"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_8"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -871,7 +827,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_9"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_9"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -901,7 +857,7 @@ SET SESSION debug_dbug="+d,ib_import_OOM_10"; --error ER_OUT_OF_RESOURCES ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_OOM_10"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -933,7 +889,7 @@ SET SESSION debug_dbug="+d,ib_import_internal_error"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_internal_error"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -974,7 +930,7 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF -SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Test failure after attempting a tablespace open SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; @@ -984,7 +940,7 @@ SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -999,7 +955,7 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -1013,7 +969,7 @@ SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -1027,7 +983,7 @@ SET SESSION debug_dbug="+d,ib_import_cluster_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_cluster_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -1041,7 +997,7 @@ SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; @@ -1055,7 +1011,7 @@ SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Left over from the failed IMPORT perl; @@ -1087,7 +1043,9 @@ CREATE TABLE test_wl5522.t1 ( INDEX idx3(c4(512))) Engine=InnoDB; # Stop purge so that it doesn't remove the delete marked entries. -SET GLOBAL INNODB_PURGE_STOP_NOW=ON; +connect (purge_control,localhost,root); +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; # Disable change buffer merge from the master thread, additionally # enable aggressive flushing so that more changes are buffered. @@ -1157,7 +1115,10 @@ SELECT name SET GLOBAL innodb_disable_background_merge=OFF; # Enable normal operation -SET GLOBAL INNODB_PURGE_RUN_NOW=ON; +connection purge_control; +COMMIT; +disconnect purge_control; +connection default; DROP TABLE test_wl5522.t1; @@ -1195,8 +1156,8 @@ DROP TABLE test_wl5522.t1; # a Btree that has several levels CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; -INSERT INTO test_wl5522.t1 VALUES - (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); +INSERT IGNORE INTO test_wl5522.t1 VALUES + (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731)); INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; @@ -1238,7 +1199,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1262,14 +1223,14 @@ do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF -SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1299,7 +1260,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; --error ER_INNODB_INDEX_CORRUPT ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1329,7 +1290,7 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1349,7 +1310,7 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); -SET SESSION debug_dbug="-d,ib_import_create_index_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1380,7 +1341,7 @@ SET SESSION debug_dbug="+d,fil_space_create_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,fil_space_create_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1411,7 +1372,7 @@ SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1442,7 +1403,7 @@ SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; @@ -1491,4 +1452,3 @@ call mtr.add_suppression("while reading index meta-data, expected to read 44 byt --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; - diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result similarity index 86% rename from mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result rename to mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 3ce55ef0409..1778437927e 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -1,21 +1,12 @@ -call mtr.add_suppression("InnoDB: Page for tablespace .* "); -call mtr.add_suppression("InnoSB: Warning: database page corruption or a failed .*"); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); +call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace "); +call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); FLUSH TABLES; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -SET GLOBAL innodb_file_format = `Barracuda`; -SELECT @@innodb_file_format; -@@innodb_file_format -Barracuda +SET GLOBAL innodb_file_per_table=1; +SET GLOBAL innodb_file_format=Barracuda; SET SESSION innodb_strict_mode=1; -SELECT @@SESSION.innodb_strict_mode; -@@SESSION.innodb_strict_mode -1 -DROP DATABASE IF EXISTS test_wl5522; -Warnings: -Note 1008 Can't drop database 'test_wl5522'; database doesn't exist CREATE DATABASE test_wl5522; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; @@ -36,7 +27,6 @@ SELECT * FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Lost connection to MySQL server during query -SET SESSION debug_dbug="-d,ib_import_before_commit_crash"; SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' @@ -45,20 +35,12 @@ ERROR HY000: Lost connection to MySQL server during query unlink: t1.ibd unlink: t1.cfg # Restart and reconnect to the server -SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash"; DROP TABLE test_wl5522.t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; -@@innodb_file_per_table -1 -SET GLOBAL innodb_file_format = `Barracuda`; -SELECT @@innodb_file_format; -@@innodb_file_format -Barracuda SET SESSION innodb_strict_mode=1; -SELECT @@SESSION.innodb_strict_mode; -@@SESSION.innodb_strict_mode -1 +SET @file_per_table = @@GLOBAL.innodb_file_per_table; +SET @file_format = @@GLOBAL.innodb_file_format; +SET GLOBAL innodb_file_per_table=1; +SET GLOBAL innodb_file_format=Barracuda; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; @@ -87,10 +69,11 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files +SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_import_internal_error"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: While updating the of index "GEN_CLUST_INDEX" - Generic error -SET SESSION debug_dbug="-d,ib_import_internal_error"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; DROP TABLE test_wl5522.t1; @@ -104,36 +87,36 @@ SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Too many concurrent transactions restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 44 't1.ibd -SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_cluster_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_cluster_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; unlink: t1.ibd unlink: t1.cfg DROP TABLE test_wl5522.t1; @@ -145,8 +128,8 @@ c4 VARCHAR(2048), INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; -SET GLOBAL INNODB_PURGE_STOP_NOW=ON; +ROW_FORMAT=COMPRESSED; +START TRANSACTION WITH CONSISTENT SNAPSHOT; SET GLOBAL innodb_disable_background_merge=ON; SET GLOBAL innodb_monitor_reset = ibuf_merges; SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; @@ -189,7 +172,7 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED SELECT c1, c2 FROM test_wl5522.t1; c1 c2 2 32 @@ -311,7 +294,7 @@ FROM information_schema.innodb_metrics WHERE name = 'ibuf_merges_inserts' AND count > 0; name SET GLOBAL innodb_disable_background_merge=OFF; -SET GLOBAL INNODB_PURGE_RUN_NOW=ON; +COMMIT; DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 ( c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, @@ -321,7 +304,7 @@ c4 VARCHAR(2048), INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +ROW_FORMAT=COMPRESSED; SELECT c1, c2 FROM test_wl5522.t1; c1 c2 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; @@ -445,11 +428,11 @@ t1 CREATE TABLE `t1` ( KEY `idx1` (`c2`), KEY `idx2` (`c3`(512)), KEY `idx3` (`c4`(512)) -) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT INTO test_wl5522.t1 VALUES +INSERT IGNORE INTO test_wl5522.t1 VALUES (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); Warnings: Warning 1265 Data truncated for column 'c2' at row 1 @@ -477,7 +460,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -487,9 +470,10 @@ ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; SELECT COUNT(*) FROM test_wl5522.t1; ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files -SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure"; +ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Data structure corruption +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -502,7 +486,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Index corrupt: Externally stored column(5) has a reference length of 19 in the cluster index "GEN_CLUST_INDEX" -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -515,7 +499,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Incorrect key file for table 't1'; try to repair it -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -528,7 +512,7 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); Warnings: Warning 1814 Tablespace has been discarded for table 't1' -SET SESSION debug_dbug="-d,ib_import_create_index_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -541,7 +525,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fil_space_create_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 11 't1.ibd -SET SESSION debug_dbug="-d,fil_space_create_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -554,7 +538,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Got error 39 't1.ibd -SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -567,7 +551,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; ERROR HY000: Internal error: Cannot reset LSNs in table '"test_wl5522"."t1"' : Unsupported -SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; unlink: t1.ibd unlink: t1.cfg @@ -578,6 +562,5 @@ set global innodb_monitor_enable = default; set global innodb_monitor_disable = default; set global innodb_monitor_reset = default; set global innodb_monitor_reset_all = default; -SET GLOBAL INNODB_FILE_PER_TABLE=1; -SET GLOBAL INNODB_FILE_FORMAT=Antelope; -SET SESSION innodb_strict_mode=0; +SET GLOBAL innodb_file_per_table = @file_per_table; +SET GLOBAL innodb_file_format = @file_format; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test similarity index 79% rename from mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test rename to mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 37b630ad47b..65b030c018f 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -1,45 +1,32 @@ -# Not supported in embedded +# mysql-test-run.pl --embedded cannot restart the server. --source include/not_embedded.inc # This test case needs to crash the server. Needs a debug server. --source include/have_debug.inc -# Don't test this under valgrind, memory leaks will occur. +# Valgrind can hang or return spurious messages on DBUG_SUICIDE --source include/not_valgrind.inc # Avoid CrashReporter popup on Mac --source include/not_crashrep.inc --- source include/have_innodb.inc +-- source include/innodb_page_size_small.inc -# compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16 -# Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so -# allow test to run only when innodb-page-size=16 ---source include/have_innodb_16k.inc - -# Test intentionally crashes the server, corrupted pages possible -call mtr.add_suppression("InnoDB: Page for tablespace .* "); -call mtr.add_suppression("InnoSB: Warning: database page corruption or a failed .*"); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue."); +call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file .*"); +call mtr.add_suppression("InnoDB: Page for tablespace "); +call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); FLUSH TABLES; +SET GLOBAL innodb_file_per_table=1; +SET GLOBAL innodb_file_format=Barracuda; + let MYSQLD_DATADIR =`SELECT @@datadir`; -let $innodb_file_per_table = `SELECT @@innodb_file_per_table`; -let $innodb_file_format = `SELECT @@innodb_file_format`; -let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`; let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; - -SET GLOBAL innodb_file_format = `Barracuda`; -SELECT @@innodb_file_format; - SET SESSION innodb_strict_mode=1; -SELECT @@SESSION.innodb_strict_mode; - - -DROP DATABASE IF EXISTS test_wl5522; CREATE DATABASE test_wl5522; # Create the table that we will use for crash recovery (during IMPORT) @@ -52,7 +39,7 @@ INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); FLUSH TABLES test_wl5522.t1 FOR EXPORT; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test_wl5522", "t1"); EOF UNLOCK TABLES; @@ -66,7 +53,7 @@ INSERT INTO test_wl5522.t1 VALUES (1); ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_discard_tablespaces("test_wl5522", "t1"); EOF @@ -75,7 +62,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -96,7 +83,6 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; --source include/wait_until_connected_again.inc --disable_reconnect -SET SESSION debug_dbug="-d,ib_import_before_commit_crash"; #### Before commit crash # Check that the DD is consistent after recovery @@ -119,7 +105,7 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; # recreate the table and do a proper import. -- source include/wait_until_disconnected.inc perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -129,7 +115,6 @@ EOF --source include/wait_until_connected_again.inc --disable_reconnect -SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash"; #### Before checkpoint crash # After the above test the results are non-deterministic, recreate the table @@ -137,14 +122,12 @@ SET SESSION debug_dbug="-d,ib_import_before_checkpoint_crash"; DROP TABLE test_wl5522.t1; -SET GLOBAL innodb_file_per_table = 1; -SELECT @@innodb_file_per_table; - -SET GLOBAL innodb_file_format = `Barracuda`; -SELECT @@innodb_file_format; - SET SESSION innodb_strict_mode=1; -SELECT @@SESSION.innodb_strict_mode; +SET @file_per_table = @@GLOBAL.innodb_file_per_table; +SET @file_format = @@GLOBAL.innodb_file_format; + +SET GLOBAL innodb_file_per_table=1; +SET GLOBAL innodb_file_format=Barracuda; CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb ROW_FORMAT=COMPRESSED; @@ -152,7 +135,7 @@ ROW_FORMAT=COMPRESSED; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -178,11 +161,12 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF # Test failure after reset of space id and LSN in the tablespace +SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_import_internal_error"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ @@ -190,11 +174,11 @@ SET SESSION debug_dbug="+d,ib_import_internal_error"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_internal_error"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -214,7 +198,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -228,11 +212,11 @@ ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF -SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Test failure after attempting a tablespace open SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; @@ -241,11 +225,11 @@ SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -256,11 +240,11 @@ SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_check_bitmap_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -270,11 +254,11 @@ SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_cluster_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -284,11 +268,11 @@ SET SESSION debug_dbug="+d,ib_import_cluster_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_cluster_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -298,11 +282,11 @@ SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_sec_root_adjust_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -312,11 +296,11 @@ SET SESSION debug_dbug="+d,ib_import_set_max_rowid_failure"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_set_max_rowid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; # Left over from the failed IMPORT perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -342,10 +326,12 @@ CREATE TABLE test_wl5522.t1 ( INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB - ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; + ROW_FORMAT=COMPRESSED; # Stop purge so that it doesn't remove the delete marked entries. -SET GLOBAL INNODB_PURGE_STOP_NOW=ON; +connect (purge_control,localhost,root); +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; # Disable change buffer merge from the master thread, additionally # enable aggressive flushing so that more changes are buffered. @@ -398,7 +384,7 @@ SELECT name FLUSH TABLES test_wl5522.t1 FOR EXPORT; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test_wl5522", "t1"); EOF @@ -415,7 +401,10 @@ SELECT name SET GLOBAL innodb_disable_background_merge=OFF; # Enable normal operation -SET GLOBAL INNODB_PURGE_RUN_NOW=ON; +connection purge_control; +COMMIT; +disconnect purge_control; +connection default; DROP TABLE test_wl5522.t1; @@ -427,14 +416,14 @@ CREATE TABLE test_wl5522.t1 ( INDEX idx1(c2), INDEX idx2(c3(512)), INDEX idx3(c4(512))) Engine=InnoDB - ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; + ROW_FORMAT=COMPRESSED; SELECT c1, c2 FROM test_wl5522.t1; ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -455,7 +444,7 @@ DROP TABLE test_wl5522.t1; CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; -INSERT INTO test_wl5522.t1 VALUES +INSERT IGNORE INTO test_wl5522.t1 VALUES (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200)); INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; @@ -470,7 +459,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; FLUSH TABLES test_wl5522.t1 FOR EXPORT; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_backup_tablespaces("test_wl5522", "t1"); EOF @@ -488,7 +477,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -499,12 +488,12 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -520,24 +509,24 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF -SET SESSION debug_dbug="+d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug="+d,buf_page_import_corrupt_failure"; --replace_regex /'.*t1.cfg'/'t1.cfg'/ -# Following alter is not failing -#--error ER_INTERNAL_ERROR +# Following alter is failing +--error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,buf_page_is_corrupt_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -551,7 +540,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -562,12 +551,12 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; --error ER_INNODB_INDEX_CORRUPT ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_2"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -581,7 +570,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -592,12 +581,12 @@ SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; --error ER_NOT_KEYFILE ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,ib_import_trigger_corruption_3"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -613,12 +602,12 @@ SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); -SET SESSION debug_dbug="-d,ib_import_create_index_failure_1"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -634,7 +623,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -644,12 +633,12 @@ SET SESSION debug_dbug="+d,fil_space_create_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,fil_space_create_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -665,7 +654,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -675,12 +664,12 @@ SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -696,7 +685,7 @@ SELECT COUNT(*) FROM test_wl5522.t1; # Restore files perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_restore_tablespaces("test_wl5522", "t1"); EOF @@ -707,12 +696,12 @@ SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; --error ER_INTERNAL_ERROR ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -SET SESSION debug_dbug="-d,fsp_flags_is_valid_failure"; +SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE test_wl5522.t1; perl; -do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; ib_unlink_tablespace("test_wl5522", "t1"); EOF @@ -747,13 +736,12 @@ call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted"); call mtr.add_suppression("but tablespace with that id or name does not exist"); call mtr.add_suppression("Failed to find tablespace for table '\"test_wl5522\".\"t1\"' in the cache"); call mtr.add_suppression("Could not find a valid tablespace file for 'test_wl5522.*t1'"); +call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); --enable_query_log #cleanup --remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd -eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; -eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format; -eval SET SESSION innodb_strict_mode=$innodb_strict_mode_orig; - +SET GLOBAL innodb_file_per_table = @file_per_table; +SET GLOBAL innodb_file_format = @file_format; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 518d5ad323d..f534f8906f4 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -577,6 +577,8 @@ buf_page_is_corrupted( ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ { + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); ); + ulint checksum_field1; ulint checksum_field2; @@ -658,8 +660,6 @@ buf_page_is_corrupted( return(FALSE); } - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); ); - ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET); ulint space_id = mach_read_from_4(read_buf + FIL_PAGE_SPACE_ID); const srv_checksum_algorithm_t curr_algo = @@ -4216,7 +4216,7 @@ buf_page_io_complete( /* Not a real corruption if it was triggered by error injection */ - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", if (bpage->space > TRX_SYS_SPACE && buf_mark_space_corrupt(bpage)) { ib_logf(IB_LOG_LEVEL_INFO, @@ -4279,7 +4279,7 @@ corrupt: } } - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", page_not_corrupt: bpage = bpage; ); if (recv_recovery_is_on()) { diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index ba4cc0924b9..f0b02d863d3 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -5099,7 +5099,20 @@ ibuf_check_bitmap_on_import( return(DB_TABLE_NOT_FOUND); } - size = fil_space_get_size(space_id); + mtr_t mtr; + mtr_start(&mtr); + { + buf_block_t* sp = buf_page_get(space_id, zip_size, 0, + RW_S_LATCH, &mtr); + if (sp) { + size = mach_read_from_4( + FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + sp->frame); + } else { + size = 0; + } + } + mtr_commit(&mtr); if (size == 0) { return(DB_TABLE_NOT_FOUND); @@ -5110,7 +5123,6 @@ ibuf_check_bitmap_on_import( page_size = zip_size ? zip_size : UNIV_PAGE_SIZE; for (page_no = 0; page_no < size; page_no += page_size) { - mtr_t mtr; page_t* bitmap_page; ulint i; diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index d211bf382cf..4ad19c778ec 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -646,6 +646,8 @@ buf_page_is_corrupted( ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ { + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); ); + ulint checksum_field1; ulint checksum_field2; @@ -727,8 +729,6 @@ buf_page_is_corrupted( return(FALSE); } - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); ); - ulint page_no = mach_read_from_4(read_buf + FIL_PAGE_OFFSET); ulint space_id = mach_read_from_4(read_buf + FIL_PAGE_SPACE_ID); const srv_checksum_algorithm_t curr_algo = @@ -4421,7 +4421,7 @@ buf_page_io_complete( /* Not a real corruption if it was triggered by error injection */ - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", if (bpage->space > TRX_SYS_SPACE && buf_mark_space_corrupt(bpage)) { ib_logf(IB_LOG_LEVEL_INFO, @@ -4502,7 +4502,7 @@ corrupt: } } /**/ - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", page_not_corrupt: bpage = bpage; ); if (recv_recovery_is_on()) { diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index fb5d4ffa3af..fabe468fb0c 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -5141,7 +5141,20 @@ ibuf_check_bitmap_on_import( return(DB_TABLE_NOT_FOUND); } - size = fil_space_get_size(space_id); + mtr_t mtr; + mtr_start(&mtr); + { + buf_block_t* sp = buf_page_get(space_id, zip_size, 0, + RW_S_LATCH, &mtr); + if (sp) { + size = mach_read_from_4( + FSP_HEADER_OFFSET + FSP_FREE_LIMIT + + sp->frame); + } else { + size = 0; + } + } + mtr_commit(&mtr); if (size == 0) { return(DB_TABLE_NOT_FOUND); @@ -5152,7 +5165,6 @@ ibuf_check_bitmap_on_import( page_size = zip_size ? zip_size : UNIV_PAGE_SIZE; for (page_no = 0; page_no < size; page_no += page_size) { - mtr_t mtr; page_t* bitmap_page; ulint i;