set names utf8;
SET UNIQUE_CHECKS=0;
CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100),
c INT,
z INT,
INDEX idx(b))
ENGINE=InnoDB;
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_ā;
a	b	c	z
1	x	1	1
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā;
count(*)
2
SET @save_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,dict_set_index_corrupted';
check table corrupt_bit_test_ā;
Table	Op	Msg_type	Msg_text
test.corrupt_bit_test_ā	check	Warning	InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā	check	Warning	InnoDB: Index "idxā" is marked as corrupted
test.corrupt_bit_test_ā	check	Warning	InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā	check	error	Corrupt
SET debug_dbug = @save_dbug;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index corrupt_bit_test_ā is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
ERROR HY000: Index corrupt_bit_test_ā is corrupted
select c from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted
show warnings;
Level	Code	Message
Warning	179	InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted
Warning	179	Got error 179 when reading table `test`.`corrupt_bit_test_ā`
Error	1712	Index corrupt_bit_test_ā is corrupted
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
select * from corrupt_bit_test_ā use index(primary) where a = 10001;
a	b	c	z
10001	a	20001	20001
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_ā;
Table	Op	Msg_type	Msg_text
test.corrupt_bit_test_ā	check	Warning	InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā	check	Warning	InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā	check	error	Corrupt
set names utf8;
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted
show create table corrupt_bit_test_ā;
Table	Create Table
corrupt_bit_test_ā	CREATE TABLE `corrupt_bit_test_ā` (
  `a` int(11) NOT NULL AUTO_INCREMENT,
  `b` char(100) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `z` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  UNIQUE KEY `idxē` (`z`,`b`),
  KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
drop index idxē on corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
ERROR HY000: Index corrupt_bit_test_ā is corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
ERROR HY000: Index corrupt_bit_test_ā is corrupted
show create table corrupt_bit_test_ā;
Table	Create Table
corrupt_bit_test_ā	CREATE TABLE `corrupt_bit_test_ā` (
  `a` int(11) NOT NULL AUTO_INCREMENT,
  `b` char(100) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `z` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
drop index idx on corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
select z from corrupt_bit_test_ā limit 10;
z
20001
1
2
drop table corrupt_bit_test_ā;
