Debian Codegraph @

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

raw
1 # This is the test for bug 47622. There could be index
2 # metadata sequence mismatch between MySQL and Innodb
3 # after creating index through FIC interfaces.
4 # We resolve the problem by sync the index sequence
5 # up when opening the table.
6
7
8 connect (a,localhost,root,,);
9 connect (b,localhost,root,,);
10
11 # Create a table with a non-unique index
12 CREATE TABLE bug47622(
13 `rule_key` int(11) NOT NULL DEFAULT '0',
14 `seq` smallint(6) NOT NULL DEFAULT '0',
15 `action` smallint(6) NOT NULL DEFAULT '0',
16 `arg_id` smallint(6) DEFAULT NULL,
17 `else_ind` TINYINT NOT NULL,
18 KEY IDX_A (`arg_id`)
19 ) ENGINE=InnoDB;
20
21 connection a;
22
23 # A subsequent creating unique index should not trigger
24 # any error message. Unique index would be ranked ahead
25 # of regular index.
26 ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id);
27
28 drop index IDX_B on bug47622;
29
30 # In another connection, create additional set of normal
31 # index and unique index. Again, unique index would be ranked
32 # ahead of regular index.
33 connection b;
34 create index idx on bug47622(seq, arg_id);
35
36 ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action);
37
38 drop table bug47622;
39
40 # Create a table with one Primary key and a non-unique key
41 CREATE TABLE bug47622 (
42 `a` int(11) NOT NULL,
43 `b` int(11) DEFAULT NULL,
44 `c` char(10) DEFAULT NULL,
45 `d` varchar(20) DEFAULT NULL,
46 PRIMARY KEY (`a`),
47 KEY `b` (`b`)
48 ) ENGINE=InnoDB;
49
50 # Add two index with one unique and one non-unique.
51 # Index sequence is "PRIMARY", "c", "b" and "d"
52 alter table bug47622 add unique index (c), add index (d);
53
54 drop table bug47622;