Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/innodb/t/innodb_corrupt_bit.test |
# # Test for persistent corrupt bit for corrupted index and table # -- source include/have_innodb.inc --source include/not_embedded.inc # This test needs debug server --source include/have_debug.inc --disable_query_log call mtr.add_suppression("Flagged corruption of.* in table .* in CHECK TABLE"); --enable_query_log set names utf8; CREATE TABLE corrupt_bit_test_ā( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(100), c INT, z INT, INDEX idx(b)) ENGINE=InnoDB STATS_PERSISTENT=0; INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b); CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); SELECT * FROM corrupt_bit_test_ā; INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā; # This will flag all secondary indexes corrupted SET SESSION debug="+d,dict_set_index_corrupted"; check table corrupt_bit_test_ā; SET SESSION debug="-d,dict_set_index_corrupted"; # Cannot create new indexes while corrupted indexes exist --error ER_CHECK_NO_SUCH_TABLE CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); --error ER_CHECK_NO_SUCH_TABLE CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); # This selection intend to use the corrupted index. Expect to fail -- error ER_INDEX_CORRUPT select c from corrupt_bit_test_ā; -- error ER_INDEX_CORRUPT select z from corrupt_bit_test_ā; show warnings; # Since corrupted index is a secondary index, we only disable such # index and allow other DML to proceed insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); # This does not use the corrupted index, expect to succeed select * from corrupt_bit_test_ā use index(primary) where a = 10001; # Some more DMLs begin; insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002); delete from corrupt_bit_test_ā where a = 10001; insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); rollback; drop index idxā on corrupt_bit_test_ā; check table corrupt_bit_test_ā; set names utf8; -- error ER_INDEX_CORRUPT select z from corrupt_bit_test_ā; # Drop the corrupted index drop index idxē on corrupt_bit_test_ā; # Cannot create new indexes while a corrupt index exists. --error ER_CHECK_NO_SUCH_TABLE CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); --error ER_CHECK_NO_SUCH_TABLE CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); drop index idx on corrupt_bit_test_ā; # Now that there exist no corrupted indexes, we can create new indexes. CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); # Now select back to normal select z from corrupt_bit_test_ā limit 10; # Drop table drop table corrupt_bit_test_ā;