diff options
-rw-r--r-- | mysql-test/suite/maria/lock.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/maria/lock.test | 8 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result index 101347c7d4c..b67d1ab7b0d 100644 --- a/mysql-test/suite/maria/lock.result +++ b/mysql-test/suite/maria/lock.result @@ -27,3 +27,6 @@ i drop table t2; unlock tables; drop table t1; +CREATE TABLE t1 (i INT) ENGINE=Aria; +LOCK TABLES t1 WRITE, t1 AS t1a WRITE; +DROP TABLE t1; diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test index 6116f0b5f08..5b6d17069e7 100644 --- a/mysql-test/suite/maria/lock.test +++ b/mysql-test/suite/maria/lock.test @@ -42,3 +42,11 @@ select * from t1; drop table t2; unlock tables; drop table t1; + +# +# MDEV-366: lock table twice with LOCK TABLES and then drop it +# + +CREATE TABLE t1 (i INT) ENGINE=Aria; +LOCK TABLES t1 WRITE, t1 AS t1a WRITE; +DROP TABLE t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0a858b2c345..db5435b9b27 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2187,7 +2187,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, if (thd->locked_tables_mode) { - if (wait_while_table_is_used(thd, table->table, HA_EXTRA_FORCE_REOPEN)) + if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) { error= -1; goto err; |