From f2c7972a3da51acd0e869878c0950d546d29a6e9 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 3 Dec 2018 01:12:04 +0530 Subject: [PATCH] MDEV-17432 Assertion `lock_trx_has_sys_table_locks(trx) == 0' failed upon ALTER TABLE .. ADD FOREIGN KEY - This is a regression of commit b26e603aebc0c375751cc1d08029b3fb603a0373. While dropping the incompletely created table, InnoDB shouldn't consider that operation as non-atomic one. --- mysql-test/suite/innodb/t/table_flags.test | 6 ++++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index 07fe39664f2..69f5d00693b 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -207,3 +207,9 @@ DROP TABLE tr,tc,td,tz,tp; --list_files $bugdir --remove_files_wildcard $bugdir --rmdir $bugdir + +call mtr.add_suppression("ERROR HY000: Can't create table `test`.`t1`"); +--error ER_CANT_CREATE_TABLE +CREATE TABLE t1(f1 INT, f2 VARCHAR(1), KEY k1(f2), + FULLTEXT KEY(f2), + FOREIGN KEY (f2) REFERENCES t1(f3))ENGINE=InnoDB; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6daffbd7ec1..cadb2969c7f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12865,7 +12865,8 @@ ha_innobase::create( if (info.drop_before_rollback()) { trx->error_state = DB_SUCCESS; row_drop_table_for_mysql(info.table_name(), - trx, SQLCOM_TRUNCATE, true); + trx, SQLCOM_TRUNCATE, true, + false); } trx_rollback_for_mysql(trx); row_mysql_unlock_data_dictionary(trx);