innodb-alter-debug.test 2.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc

--source include/count_sessions.inc

SET NAMES utf8;

CREATE TABLE  (
 c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2))
ENGINE = InnoDB;

CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2),
                  CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES (c2))
ENGINE=InnoDB;

INSERT INTO  SET c1 = 1;

SET DEBUG = '+d,ib_drop_foreign_error';
--error ER_RECORD_FILE_FULL
ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ;
SET DEBUG = '-d,ib_drop_foreign_error';

SET DEBUG = '+d,ib_rename_column_error';
--error ER_RECORD_FILE_FULL
ALTER TABLE  CHANGE c2 š INT;
SET DEBUG = '-d,ib_rename_column_error';

SHOW CREATE TABLE t1ć;

DROP TABLE t1ć, ;

--echo #
--echo # Bug #21364096  THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL
--echo #                WITH INCORRECT KEY NAME

create table t1 (id int auto_increment primary key, a int, unique key uk(a))
engine = innodb;
insert into t1 select 1, 1;
insert into t1 select 2, 2;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2';
--send alter table t1 add b int, ALGORITHM=inplace

--echo /* connection con1 */
connect (con1,localhost,root,,);
SET DEBUG_SYNC = 'now WAIT_FOR s1';
--error ER_DUP_ENTRY
insert into t1 select NULL, 1;
SET DEBUG_SYNC = 'now SIGNAL s2';

--echo /* connection default */
connection default;
--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace;
--error ER_DUP_ENTRY
--reap

SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2';
--send alter table t1 add b int, ALGORITHM=inplace;

--echo /* connection con1 */
connection con1;
set DEBUG_SYNC = 'now WAIT_FOR s1';
--error ER_DUP_ENTRY
update t1 set a=1 where id=2;
SET DEBUG_SYNC = 'now SIGNAL s2';
disconnect con1;

--echo /* connection default */
connection default;
--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace;
--error ER_DUP_ENTRY
--reap

drop table t1;

# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc