Debian Codegraph @

mysql-test/suite/innodb_zip/include/atomic_truncate_table_crash_stripped.inc

raw
1 #
2 # WL#6501: make truncate table atomic
3 #
4
5 --source include/have_debug.inc
6
7 # Valgrind would complain about memory leaks when we crash on purpose.
8 --source include/not_valgrind.inc
9 # Avoid CrashReporter popup on Mac
10 --source include/not_crashrep.inc
11
12 # suppress expected warnings.
13 call mtr.add_suppression("The file '.*' already exists though the corresponding table did not exist in the InnoDB data dictionary");
14 call mtr.add_suppression("Cannot create file '.*'");
15 call mtr.add_suppression("InnoDB: Error number 17 means 'File exists'");
16
17 ################################################################################
18 #
19 # Will test following scenarios:
20 # 1. Hit crash point on completing drop of all indexes before creation of index
21 # is commenced.
22 # 2. Hit crash point after data is updated to system-table and in-memory dict.
23 # 3. Post truncate recovery, abruptly shutdown the server.
24 # On restart ensure table state is maintained.
25 #
26 ################################################################################
27
28 #-----------------------------------------------------------------------------
29 #
30 # create test-bed
31 #
32
33 let $WL6501_TMP_DIR = `select @@tmpdir`;
34 let $WL6501_DATA_DIR = `select @@datadir`;
35 let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
36
37 #-----------------------------------------------------------------------------
38 #
39 # 1. Hit crash point on completing drop of all indexes before creation of index
40 # is commenced.
41 #
42 --echo "1. Hit crash point on completing drop of all indexes before creation"
43 --echo " of index is commenced."
44 eval set global innodb_file_per_table = $wl6501_file_per_table;
45 set innodb_strict_mode=off;
46 --disable_warnings
47 eval create $wl6501_temp table t (
48 i int, f float, c char,
49 primary key pk(i), unique findex(f), index ck(c))
50 engine = innodb row_format = $wl6501_row_fmt
51 key_block_size = $wl6501_kbs;
52 --enable_warnings
53 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
54 select * from t;
55 check table t;
56 #
57 set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
58 --source include/expect_crash.inc
59 --error 2013
60 truncate table t;
61 #
62 --source include/start_mysqld.inc
63
64 check table t;
65 select * from t;
66 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
67 select * from t;
68 select * from t where f < 2.5;
69 drop table t;
70
71 #-----------------------------------------------------------------------------
72 #
73 # 2. Hit crash point after data is updated to system-table and in-memory dict.
74 #
75 --echo "2. Hit crash point after data is updated to system-table and"
76 --echo " in-memory dict."
77 eval set global innodb_file_per_table = $wl6501_file_per_table;
78 set innodb_strict_mode=off;
79 --disable_warnings
80 eval create $wl6501_temp table t (
81 i int, f float, c char,
82 primary key pk(i), unique findex(f), index ck(c))
83 engine = innodb row_format = $wl6501_row_fmt
84 key_block_size = $wl6501_kbs;
85 --enable_warnings
86 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
87 select * from t;
88 check table t;
89 #
90 set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
91 --source include/expect_crash.inc
92 --error 2013
93 truncate table t;
94 #
95 --source include/start_mysqld.inc
96 check table t;
97 select * from t;
98 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
99 select * from t;
100 select * from t where f < 2.5;
101 drop table t;
102
103 #-----------------------------------------------------------------------------
104 #
105 # 3. Post truncate recovery, abruptly shutdown the server.
106 # On restart ensure table state is maintained.
107 #
108 --echo "3. Post truncate recovery, abruptly shutdown the server."
109 --echo " On restart ensure table state is maintained."
110 eval set global innodb_file_per_table = $wl6501_file_per_table;
111 set innodb_strict_mode=off;
112 --disable_warnings
113 eval create $wl6501_temp table t (
114 i int, f float, c char,
115 primary key pk(i), unique findex(f), index ck(c))
116 engine = innodb row_format = $wl6501_row_fmt
117 key_block_size = $wl6501_kbs;
118 --enable_warnings
119 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
120 select * from t;
121 check table t;
122 #
123 set session debug = "+d,ib_trunc_crash_after_redo_log_write_complete";
124 --source include/expect_crash.inc
125 --error 2013
126 truncate table t;
127 #
128 --source include/start_mysqld.inc
129 check table t;
130 select * from t;
131 insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
132 #
133 --source include/kill_and_restart_mysqld.inc
134 #
135 check table t;
136 select * from t;
137 select * from t where f < 2.5;
138 drop table t;