summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result8
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test13
-rw-r--r--sql/sql_table.cc4
3 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 65b7da143a4..6ac3e8e6302 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2620,3 +2620,11 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
+#
+# Test for bug #56619 - Assertion failed during
+# ALTER TABLE RENAME, DISABLE KEYS
+#
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
+ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
+DROP TABLE IF EXISTS t1, t2;
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 09dc4c9f187..e99c3c27673 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -845,3 +845,16 @@ create table t2 (fk int, key x (fk),
constraint x foreign key (FK) references t1 (PK)) engine=InnoDB;
show create table t2;
drop table t2, t1;
+
+--echo #
+--echo # Test for bug #56619 - Assertion failed during
+--echo # ALTER TABLE RENAME, DISABLE KEYS
+--echo #
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
+--disable_warnings
+ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 971e1022d63..b919ea9eae7 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6832,7 +6832,6 @@ view_err:
table->alias);
}
- VOID(pthread_mutex_lock(&LOCK_open));
/*
Unlike to the above case close_cached_table() below will remove ALL
instances of TABLE from table cache (it will also remove table lock
@@ -6853,6 +6852,7 @@ view_err:
*/
ha_autocommit_or_rollback(thd, 0);
+ VOID(pthread_mutex_lock(&LOCK_open));
/*
Then do a 'simple' rename of the table. First we need to close all
instances of 'source' table.
@@ -6885,6 +6885,8 @@ view_err:
}
}
}
+ else
+ VOID(pthread_mutex_lock(&LOCK_open));
if (error == HA_ERR_WRONG_COMMAND)
{