| 1 |
set names utf8; |
| 2 |
Warnings: |
| 3 |
Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous. |
| 4 |
CREATE TABLE t( |
| 5 |
a INT AUTO_INCREMENT PRIMARY KEY, |
| 6 |
b CHAR(100), |
| 7 |
c INT, |
| 8 |
z INT, |
| 9 |
INDEX idx(b)) |
| 10 |
ENGINE=InnoDB STATS_PERSISTENT=0; |
| 11 |
INSERT INTO t VALUES(0,'x',1, 1); |
| 12 |
CREATE UNIQUE INDEX idx1 ON t(c, b); |
| 13 |
SELECT * FROM t; |
| 14 |
a b c z |
| 15 |
1 x 1 1 |
| 16 |
INSERT INTO t SELECT 0,b,c+1,z+1 FROM t; |
| 17 |
select count(*) from t; |
| 18 |
count(*) |
| 19 |
2 |
| 20 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 21 |
# restart: --innodb-read-only |
| 22 |
SET SESSION debug="+d,dict_set_index_corrupted"; |
| 23 |
check table t; |
| 24 |
Table Op Msg_type Msg_text |
| 25 |
test.t check Warning InnoDB: The B-tree of index idx1 is corrupted. |
| 26 |
test.t check Warning InnoDB: The B-tree of index idx is corrupted. |
| 27 |
test.t check error Corrupt |
| 28 |
SET SESSION debug="-d,dict_set_index_corrupted"; |
| 29 |
select c from t; |
| 30 |
ERROR HY000: Index idx1 is corrupted |
| 31 |
show warnings; |
| 32 |
Level Code Message |
| 33 |
Warning 180 InnoDB: Index idx1 for table `test`.`t` is marked as corrupted |
| 34 |
Error 1712 Index idx1 is corrupted |
| 35 |
Error 1712 Index t is corrupted |
| 36 |
select * from t use index(primary) where a = 1; |
| 37 |
a b c z |
| 38 |
1 x 1 1 |
| 39 |
# restart |
| 40 |
DROP INDEX idx ON t; |
| 41 |
DROP INDEX idx1 ON t; |
| 42 |
drop table t; |