File: ddl_crash_basic.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (210 lines) | stat: -rw-r--r-- 6,765 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
--source include/big_test.inc
--source include/have_debug.inc
--source include/not_valgrind.inc
--source include/not_crashrep.inc
--source include/have_log_bin.inc
# Observed under high parallel load
# [ERROR] Could not find a valid tablespace ...
# [Note] Unable to open tablespace ...
#        This should be fixed after data dictionary and DDL recovery later.
# ... and the crash recovery has finally success.
--disable_query_log
CALL mtr.add_suppression("\\[ERROR\\]  Could not find a valid tablespace file for");
CALL mtr.add_suppression("\\[ERROR\\].*MLOG_FILE_RENAME: Invalid to file name.* File name in the redo log is ''");
CALL mtr.add_suppression("\\[ERROR\\].* Tablespace.*, name 'test.t1', unable to open file '.*test.t1.ibd' - Data structure corruption");
--enable_query_log

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

LET $innodb_ddl_log_crash_reset_debug_orig = `SELECT @@innodb_ddl_log_crash_reset_debug`;

--echo # Test create table crash/recovery rollback.
set global innodb_ddl_log_crash_reset_debug = 1;

eval set session debug = '+d, ddl_log_crash_after_free_tree_log_2';

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b))

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

-- error ER_NO_SUCH_TABLE
show create table t1;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test create table crash/recovery.
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_before_post_ddl';

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b))

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

show create table t1;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test drop table crash/recovery rollback.
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_crash_before_drop_log_1';
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval drop table t1

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

show create table t1;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test drop table crash/recovery.
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_before_post_ddl';

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval drop table t1

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

-- error ER_NO_SUCH_TABLE
show create table t1;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test rename table crash/recovery rollback 1.
set global innodb_ddl_log_crash_reset_debug = 1;

CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

set session debug = '+d, ddl_log_crash_before_rename_space_log_1';
--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval rename table t1 to t2

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

show create table t1;

-- error ER_NO_SUCH_TABLE
show create table t2;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test rename table crash/recovery rollback 2.
set global innodb_ddl_log_crash_reset_debug = 1;

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

set session debug = '+d, ddl_log_crash_after_rename_space_log_1';
--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval rename table t1 to t2

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

show create table t1;

-- error ER_NO_SUCH_TABLE
show create table t2;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

--echo # Test rename table crash/recovery.
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_before_post_ddl';

--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--error 0,CR_SERVER_LOST,ER_INTERNAL_ERROR
--eval rename table t1 to t2

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
let $WAIT_COUNT=6000;
--source include/wait_time_until_connected_again.inc

-- error ER_NO_SUCH_TABLE
show create table t1;

show create table t2;

SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;

drop table t2;

--echo # Test truncate table crash/recovery.
let $table_name= t1;

let $create_statement= CREATE TABLE $table_name
(a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(100), c INT NOT NULL);

let $insert_statement= INSERT INTO t1 VALUES (1, "Filler1", 1),
(2, "filler2", 2), (3, "FILLER3", 3), (4, "Filler4", 4), (5, "5", 5),
(6, "filler6", 6);


let $test_free= 1;
let $test_delete= 1;
let $test_rename= 1;
let $test_drop= 1;
let $crash_statement= TRUNCATE TABLE $table_name;
--source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc

--echo # Test optimize table crash/recovery.

let $test_free= 1;
let $test_delete= 1;
let $test_rename= 1;
let $test_drop= 1;
let $crash_statement= OPTIMIZE TABLE $table_name;
--source ../mysql-test/suite/innodb/include/ddl_crash_statement.inc

eval SET GLOBAL innodb_ddl_log_crash_reset_debug = $innodb_ddl_log_crash_reset_debug_orig;

--echo #
--echo # Bug#26832347 - INNODB: CANNOT FIND SPACE FOR TBS_.*_RENAME IN TABLESPACE MEMO
--echo #
# This test requires bin-log, make sure it is ON
SHOW VARIABLES LIKE 'log_bin';
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
--source include/expect_crash.inc
SET DEBUG='+d, ib_trx_commit_crash_rseg_updated';
--error 2013
ALTER TABLESPACE ts1 RENAME TO ts1_renamed;
--source include/start_mysqld.inc
ALTER TABLESPACE ts1_renamed RENAME TO ts1;
DROP TABLESPACE ts1;