diff options
Diffstat (limited to 'mysql-test/suite/innodb/t/alter_candidate_key.test')
-rw-r--r-- | mysql-test/suite/innodb/t/alter_candidate_key.test | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test new file mode 100644 index 00000000..824ad1ea --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_candidate_key.test @@ -0,0 +1,74 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY uidx2(f1,f2), + UNIQUE KEY uidx1(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connect (con1,localhost,root,,); +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +DELETE FROM t1; +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT, f2 INT, + PRIMARY KEY(f1, f2), + UNIQUE INDEX uidx2 (f1, f2), + UNIQUE INDEX uidx1 (f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(2, 2); +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter + SIGNAL conc_dml WAIT_FOR go_ahead'; +--send ALTER TABLE t1 CHANGE COLUMN f1 f11 INT, ALGORITHM=INPLACE +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR conc_dml'; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES(1, 1), (1, 1); +SET DEBUG_SYNC = 'now SIGNAL go_ahead'; +connection default; +reap; +SHOW CREATE TABLE t1; +CHECK TABLE t1; +DROP TABLE t1; + +SET SQL_MODE= strict_trans_tables; +CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done'; +--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL +connection con1; +SET DEBUG_SYNC='now WAIT_FOR dml'; +BEGIN; +INSERT INTO t1 SET a=NULL; +COMMIT; +set DEBUG_SYNC='now SIGNAL dml_done'; +connection default; +--error ER_INVALID_USE_OF_NULL +reap; +DROP TABLE t1; +disconnect con1; +SET DEBUG_SYNC="RESET"; +SET SQL_MODE=DEFAULT; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2), + UNIQUE KEY(f2))ENGINE=InnoDB; +ALTER TABLE t1 DROP PRIMARY KEY; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + UNIQUE KEY(f2), UNIQUE KEY(f2))ENGINE=InnoDB; +SHOW CREATE TABLE t1; +ALTER TABLE t1 DROP INDEX f2, ALGORITHM=INPLACE; +SHOW CREATE TABLE t1; +DROP TABLE t1; |