Debian Codegraph @

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

raw
1 #
2 # Test for set corrupt bit for corrupted index in read only mode
3 #
4
5 # This test needs debug server
6 --source include/have_debug.inc
7
8 --disable_query_log
9 call mtr.add_suppression("Flagged corruption of.* in table .* in CHECK TABLE");
10 call mtr.add_suppression("Skip re-populating collations and*");
11 --enable_query_log
12 --source include/add_mtr_suppression_for_innodb_readonly.inc
13
14 set names utf8;
15
16 CREATE TABLE t(
17 a INT AUTO_INCREMENT PRIMARY KEY,
18 b CHAR(100),
19 c INT,
20 z INT,
21 INDEX idx(b))
22 ENGINE=InnoDB STATS_PERSISTENT=0;
23
24 INSERT INTO t VALUES(0,'x',1, 1);
25
26 CREATE UNIQUE INDEX idx1 ON t(c, b);
27
28 SELECT * FROM t;
29
30 INSERT INTO t SELECT 0,b,c+1,z+1 FROM t;
31
32 select count(*) from t;
33
34 # restart server with read only
35 --source include/restart_innodb_read_only.inc
36
37 # This will flag all secondary indexes corrupted. It should just mark
38 # in-memory metadata as corrupted, as this is a read-only server
39 SET SESSION debug="+d,dict_set_index_corrupted";
40 check table t;
41 SET SESSION debug="-d,dict_set_index_corrupted";
42
43 -- error ER_INDEX_CORRUPT
44 select c from t;
45
46 show warnings;
47
48 # This does not use the corrupted index, expect to succeed
49 select * from t use index(primary) where a = 1;
50
51 let $restart_parameters = restart;
52 --source include/restart_mysqld.inc
53
54 DROP INDEX idx ON t;
55 DROP INDEX idx1 ON t;
56
57 # Drop table
58 drop table t;