Debian Codegraph @

mysql-test/suite/innodb/t/ddl_crash_basic.test

raw
1 --source include/big_test.inc
2 --source include/have_debug.inc
3 --source include/not_valgrind.inc
4 --source include/not_crashrep.inc
5 --source include/have_log_bin.inc
6 # Observed under high parallel load
7 # [ERROR] Could not find a valid tablespace ...
8 # [Note] Unable to open tablespace ...
9 # This should be fixed after data dictionary and DDL recovery later.
10 # ... and the crash recovery has finally success.
11 --disable_query_log
12 CALL mtr.add_suppression("\\[ERROR\\] Could not find a valid tablespace file for");
13 CALL mtr.add_suppression("\\[ERROR\\].*MLOG_FILE_RENAME: Invalid to file name.* File name in the redo log is ''");
14 CALL mtr.add_suppression("\\[ERROR\\].* Tablespace.*, name 'test.t1', unable to open file '.*test.t1.ibd' - Data structure corruption");
15 --enable_query_log
16
17 SET SESSION debug= '+d,skip_dd_table_access_check';
18 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
19
20 LET $innodb_ddl_log_crash_reset_debug_orig = `SELECT @@innodb_ddl_log_crash_reset_debug`;
21
22 --echo # Test create table crash/recovery rollback.
23 set global innodb_ddl_log_crash_reset_debug = 1;
24
25 eval set session debug = '+d, ddl_log_crash_after_free_tree_log_2';
26
27 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
28
29 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
30 --eval CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b))
31
32 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
33 --enable_reconnect
34 let $WAIT_COUNT=6000;
35 --source include/wait_time_until_connected_again.inc
36
37 -- error ER_NO_SUCH_TABLE
38 show create table t1;
39
40 SET SESSION debug= '+d,skip_dd_table_access_check';
41 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
42
43 --echo # Test create table crash/recovery.
44 set global innodb_ddl_log_crash_reset_debug = 1;
45 set session debug = '+d, ddl_log_before_post_ddl';
46
47 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
48
49 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
50 --eval CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b))
51
52 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
53 --enable_reconnect
54 let $WAIT_COUNT=6000;
55 --source include/wait_time_until_connected_again.inc
56
57 show create table t1;
58
59 SET SESSION debug= '+d,skip_dd_table_access_check';
60 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
61
62 --echo # Test drop table crash/recovery rollback.
63 set global innodb_ddl_log_crash_reset_debug = 1;
64 set session debug = '+d, ddl_log_crash_before_drop_log_1';
65 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
66
67 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
68 --eval drop table t1
69
70 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
71 --enable_reconnect
72 let $WAIT_COUNT=6000;
73 --source include/wait_time_until_connected_again.inc
74
75 show create table t1;
76
77 SET SESSION debug= '+d,skip_dd_table_access_check';
78 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
79
80 --echo # Test drop table crash/recovery.
81 set global innodb_ddl_log_crash_reset_debug = 1;
82 set session debug = '+d, ddl_log_before_post_ddl';
83
84 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
85
86 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
87 --eval drop table t1
88
89 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
90 --enable_reconnect
91 let $WAIT_COUNT=6000;
92 --source include/wait_time_until_connected_again.inc
93
94 -- error ER_NO_SUCH_TABLE
95 show create table t1;
96
97 SET SESSION debug= '+d,skip_dd_table_access_check';
98 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
99
100 --echo # Test rename table crash/recovery rollback 1.
101 set global innodb_ddl_log_crash_reset_debug = 1;
102
103 CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
104 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
105
106 set session debug = '+d, ddl_log_crash_before_rename_space_log_1';
107 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
108 --eval rename table t1 to t2
109
110 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
111 --enable_reconnect
112 let $WAIT_COUNT=6000;
113 --source include/wait_time_until_connected_again.inc
114
115 show create table t1;
116
117 -- error ER_NO_SUCH_TABLE
118 show create table t2;
119
120 SET SESSION debug= '+d,skip_dd_table_access_check';
121 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
122
123 --echo # Test rename table crash/recovery rollback 2.
124 set global innodb_ddl_log_crash_reset_debug = 1;
125
126 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
127
128 set session debug = '+d, ddl_log_crash_after_rename_space_log_1';
129 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
130 --eval rename table t1 to t2
131
132 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
133 --enable_reconnect
134 let $WAIT_COUNT=6000;
135 --source include/wait_time_until_connected_again.inc
136
137 show create table t1;
138
139 -- error ER_NO_SUCH_TABLE
140 show create table t2;
141
142 SET SESSION debug= '+d,skip_dd_table_access_check';
143 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
144
145 --echo # Test rename table crash/recovery.
146 set global innodb_ddl_log_crash_reset_debug = 1;
147 set session debug = '+d, ddl_log_before_post_ddl';
148
149 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
150
151 --error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
152 --eval rename table t1 to t2
153
154 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
155 --enable_reconnect
156 let $WAIT_COUNT=6000;
157 --source include/wait_time_until_connected_again.inc
158
159 -- error ER_NO_SUCH_TABLE
160 show create table t1;
161
162 show create table t2;
163
164 SET SESSION debug= '+d,skip_dd_table_access_check';
165 SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
166
167 drop table t2;
168
169 --echo # Test truncate table crash/recovery.
170 let $table_name= t1;
171
172 let $create_statement= CREATE TABLE $table_name
173 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL);
174
175 let $insert_statement= INSERT INTO t1 VALUES (1, "Filler1", 1),
176 (2, "filler2", 2), (3, "FILLER3", 3), (4, "Filler4", 4), (5, "5", 5),
177 (6, "filler6", 6);
178
179
180 let $test_free= 1;
181 let $test_delete= 1;
182 let $test_rename= 1;
183 let $test_drop= 1;
184 let $crash_statement= TRUNCATE TABLE $table_name;
185 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
186
187 --echo # Test optimize table crash/recovery.
188
189 let $test_free= 1;
190 let $test_delete= 1;
191 let $test_rename= 1;
192 let $test_drop= 1;
193 let $crash_statement= OPTIMIZE TABLE $table_name;
194 --source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc
195
196 eval SET GLOBAL innodb_ddl_log_crash_reset_debug = $innodb_ddl_log_crash_reset_debug_orig;
197
198 --echo #
199 --echo # Bug#26832347 - INNODB: CANNOT FIND SPACE FOR TBS_.*_RENAME IN TABLESPACE MEMO
200 --echo #
201 # This test requires bin-log, make sure it is ON
202 SHOW VARIABLES LIKE 'log_bin';
203 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
204 --source include/expect_crash.inc
205 SET DEBUG='+d, ib_trx_commit_crash_rseg_updated';
206 --error 2013
207 ALTER TABLESPACE ts1 RENAME TO ts1_renamed;
208 --source include/start_mysqld.inc
209 ALTER TABLESPACE ts1_renamed RENAME TO ts1;
210 DROP TABLESPACE ts1;