1# 2# WL#6501: make truncate table atomic 3# 4 5--source include/have_innodb.inc 6--source include/have_debug.inc 7--source include/big_test.inc 8 9# Valgrind would complain about memory leaks when we crash on purpose. 10--source include/not_valgrind.inc 11# Embedded server does not support crashing 12--source include/not_embedded.inc 13# Avoid CrashReporter popup on Mac 14--source include/not_crashrep.inc 15 16# suppress expected warnings 17call mtr.add_suppression("does not exist in the InnoDB internal"); 18 19################################################################################ 20# 21# Will test following scenarios: 22# 1. Hit crash point on completing drop of all indexes before creation of index 23# is commenced. 24# 2. Hit crash point after data is updated to system-table and in-memory dict. 25# 26################################################################################ 27 28#----------------------------------------------------------------------------- 29# 30# create test-bed 31# 32let $per_table = `select @@innodb_file_per_table`; 33let $format = `select @@innodb_file_format`; 34 35eval set global innodb_file_per_table = on; 36let $WL6501_TMP_DIR = `select @@tmpdir`; 37let $WL6501_DATA_DIR = `select @@datadir`; 38let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err; 39 40#----------------------------------------------------------------------------- 41# 42# 1. Hit crash point on completing drop of all indexes before creation of index 43# is commenced. 44# 45--echo "1. Hit crash point on completing drop of all indexes before creation" 46--echo " of index is commenced." 47eval set global innodb_file_per_table = $wl6501_file_per_table; 48eval set global innodb_file_format = $wl6501_file_format; 49set innodb_strict_mode=off; 50--disable_warnings 51eval create $wl6501_temp table t ( 52 i int, f float, c char, 53 primary key pk(i), unique findex(f), index ck(c)) 54 engine = innodb row_format = $wl6501_row_fmt 55 key_block_size = $wl6501_kbs; 56--enable_warnings 57insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); 58select * from t; 59check table t; 60# 61set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start"; 62--source include/expect_crash.inc 63--error 2013 64truncate table t; 65# 66--source include/start_mysqld.inc 67check table t; 68 69#----------------------------------------------------------------------------- 70# 71# 2. Hit crash point after data is updated to system-table and in-memory dict. 72# 73--echo "2. Hit crash point after data is updated to system-table and" 74--echo " in-memory dict." 75eval set global innodb_file_per_table = $wl6501_file_per_table; 76eval set global innodb_file_format = $wl6501_file_format; 77set innodb_strict_mode=off; 78--disable_warnings 79eval create $wl6501_temp table t ( 80 i int, f float, c char, 81 primary key pk(i), unique findex(f), index ck(c)) 82 engine = innodb row_format = $wl6501_row_fmt 83 key_block_size = $wl6501_kbs; 84--enable_warnings 85insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); 86select * from t; 87check table t; 88# 89set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info"; 90--source include/expect_crash.inc 91--error 2013 92truncate table t; 93# 94--source include/start_mysqld.inc 95check table t; 96 97#----------------------------------------------------------------------------- 98# 99# remove test-bed 100# 101eval set global innodb_file_format = $format; 102eval set global innodb_file_per_table = $per_table; 103