1SET NAMES utf8;
2CREATE TABLE ① (
3c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2))
4ENGINE = InnoDB;
5CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2),
6CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2))
7ENGINE=InnoDB;
8INSERT INTO ① SET c1 = 1;
9SET @saved_debug_dbug = @@SESSION.debug_dbug;
10SET DEBUG_DBUG = '+d,ib_drop_foreign_error';
11ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②;
12ERROR HY000: The table 't1ć' is full
13SET DEBUG_DBUG = @saved_debug_dbug;
14SET DEBUG_DBUG = '+d,ib_rename_column_error';
15ALTER TABLE ① CHANGE c2 š INT;
16ERROR HY000: The table '①' is full
17SET DEBUG_DBUG = @saved_debug_dbug;
18SHOW CREATE TABLE t1ć;
19Table	Create Table
20t1ć	CREATE TABLE `t1ć` (
21  `c1` int(11) NOT NULL,
22  `c2` int(11) DEFAULT NULL,
23  PRIMARY KEY (`c1`),
24  KEY `c2` (`c2`),
25  CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `①` (`c2`)
26) ENGINE=InnoDB DEFAULT CHARSET=latin1
27DROP TABLE t1ć, ①;
28#
29# Bug #21364096  THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL
30#                WITH INCORRECT KEY NAME
31create table t1 (id int auto_increment primary key, a int, unique key uk(a))
32engine = innodb;
33insert into t1 select 1, 1;
34insert into t1 select 2, 2;
35SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2';
36alter table t1 force, add b int, ALGORITHM=inplace;
37/* connection con1 */
38connect  con1,localhost,root,,;
39SET DEBUG_SYNC = 'now WAIT_FOR s1';
40insert into t1 select NULL, 1;
41ERROR 23000: Duplicate entry '1' for key 'uk'
42SET DEBUG_SYNC = 'now SIGNAL s2';
43/* connection default */
44connection default;
45/* reap */ alter table t1 force, add b int, ALGORITHM=inplace;
46ERROR 23000: Duplicate entry '1' for key 'uk'
47SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2';
48alter table t1 force, add b int, ALGORITHM=inplace;;
49/* connection con1 */
50connection con1;
51set DEBUG_SYNC = 'now WAIT_FOR s1';
52update t1 set a=1 where id=2;
53ERROR 23000: Duplicate entry '1' for key 'uk'
54SET DEBUG_SYNC = 'now SIGNAL s2';
55/* connection default */
56connection default;
57/* reap */ alter table t1 force, add b int, ALGORITHM=inplace;
58ERROR 23000: Duplicate entry '1' for key 'uk'
59SET DEBUG_SYNC = 'RESET';
60drop table t1;
61#
62# Bug #27753193  ASSERTION `PREBUILT->TRX->ERROR_KEY_NUM <
63#                HA_ALTER_INFO->KEY_COUNT'
64CREATE TABLE t1 (a INT, UNIQUE KEY(a)) ENGINE=InnoDB;
65INSERT INTO t1 VALUES (1);
66SET DEBUG_SYNC = 'row_log_table_apply1_before signal S1 WAIT_FOR S2';
67ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
68connection con1;
69SET DEBUG_SYNC = 'now WAIT_FOR S1';
70INSERT INTO t1 VALUES (1);
71ERROR 23000: Duplicate entry '1' for key 'a'
72SET DEBUG_SYNC = 'now SIGNAL S2';
73disconnect con1;
74connection default;
75ERROR 23000: Duplicate entry '1' for key 'a'
76SET DEBUG_SYNC='RESET';
77DROP TABLE t1;
78#
79# MDEV-17470 Orphan temporary files after interrupted ALTER
80# cause InnoDB: Operating system error number 17 and eventual
81# fatal error 71
82#
83CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB;
84INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8);
85INSERT INTO t1 SELECT NULL, i FROM t1;
86INSERT INTO t1 SELECT NULL, i FROM t1;
87INSERT INTO t1 SELECT NULL, i FROM t1;
88INSERT INTO t1 SELECT NULL, i FROM t1;
89INSERT INTO t1 SELECT NULL, i FROM t1;
90LOCK TABLE t1 READ;
91connect  con1,localhost,root,,test;
92ALTER TABLE t1 FORCE, ALGORITHM=COPY;
93connection default;
94kill query @id;
95connection con1;
96ERROR 70100: Query execution was interrupted
97disconnect con1;
98connection default;
99UNLOCK TABLES;
100DROP TABLE t1;
101#
102# MDEV-7318 RENAME INDEX
103#
104CREATE TABLE t (c1 INT, c2 INT, KEY i2 (c2)) ENGINE=INNODB;
105SET DEBUG_DBUG= '+d,ib_rename_index_fail1';
106ALTER TABLE t RENAME INDEX i2 to x, ALGORITHM=INPLACE;
107ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
108SET DEBUG_DBUG = @saved_debug_dbug;
109DROP TABLE t;
110