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
|
# This test is based on innodb_zip.wl6501_error_1 in MySQL 5.7.
--source include/have_innodb.inc
--source include/innodb_row_format.inc
--source include/have_debug.inc
SET @save_dbug = @@SESSION.debug_dbug;
call mtr.add_suppression("InnoDB: Flagged corruption of .* in table `test`\\.`t` in TRUNCATE TABLE");
--echo # 1. Error in assigning undo logs for truncate action
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
#
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_assigning_undo_log';
--error ER_GET_ERRNO
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 2. Error while preparing for truncate
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_preparing_for_truncate';
--error ER_GET_ERRNO
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
--echo # 3. Error while dropping/creating indexes
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_drop_index';
--error ER_GET_ERRNO
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_create_index';
--error ER_GET_ERRNO
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
--error ER_TABLE_CORRUPT,ER_GET_ERRNO
select * from t;
drop table t;
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100), INDEX ck(c))
ENGINE = InnoDB;
insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
check table t;
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 4. Error while completing truncate of table involving FTS
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t;
drop table t;
--echo # 5. Error while updating sys-tables
CREATE TABLE t (i int PRIMARY KEY, f float UNIQUE, c char(100),
FULLTEXT INDEX(c)) ENGINE = InnoDB;
insert into t values (1, 1.1, 'mysql is now oracle company'),
(2, 2.2, 'innodb is part of mysql'),
(3, 3.3, 'innodb is default storage engine of mysql');
check table t;
SET @@SESSION.debug_dbug = '+d,ib_err_trunc_temp_recreate_index';
truncate table t;
SET @@SESSION.debug_dbug = @save_dbug;
check table t;
select * from t order by i;
drop table t;
|