diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-03-26 19:56:23 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-03-26 19:56:23 +0100 |
commit | 44002a34e680c79c01df879b540458c2885e97e8 (patch) | |
tree | 1bf3d7685eea7d97ff7eb91f093c8430f53efbe8 | |
parent | ded448d1d035d211c8146141546a08126bb728b6 (diff) | |
download | mariadb-git-44002a34e680c79c01df879b540458c2885e97e8.tar.gz |
MDEV-5955 Server crashes in handler::ha_external_lock or assertion `m_lock_type == 2' fails in handler::ha_close on disconnect with a locked temporary table
first unlock locked tables, then close and remove temporary
-rw-r--r-- | mysql-test/r/locked_temporary-5955.result | 2 | ||||
-rw-r--r-- | mysql-test/t/locked_temporary-5955.test | 10 | ||||
-rw-r--r-- | sql/sql_class.cc | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/mysql-test/r/locked_temporary-5955.result b/mysql-test/r/locked_temporary-5955.result new file mode 100644 index 00000000000..8999bdd39c4 --- /dev/null +++ b/mysql-test/r/locked_temporary-5955.result @@ -0,0 +1,2 @@ +CREATE TEMPORARY TABLE tmp (i INT) ENGINE=InnoDB; +LOCK TABLES tmp AS p WRITE; diff --git a/mysql-test/t/locked_temporary-5955.test b/mysql-test/t/locked_temporary-5955.test new file mode 100644 index 00000000000..1ade63f4913 --- /dev/null +++ b/mysql-test/t/locked_temporary-5955.test @@ -0,0 +1,10 @@ +# +# MDEV-5955 Server crashes in handler::ha_external_lock or assertion `m_lock_type == 2' fails in handler::ha_close on disconnect with a locked temporary table +# + +--source include/have_innodb.inc +--connect (con1,localhost,root,,) +CREATE TEMPORARY TABLE tmp (i INT) ENGINE=InnoDB; +LOCK TABLES tmp AS p WRITE; +--disconnect con1 + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 4b9701c4eb5..91705de7c9b 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1391,6 +1391,7 @@ void THD::cleanup(void) #endif mysql_ha_cleanup(this); + locked_tables_list.unlock_locked_tables(this); close_temporary_tables(this); @@ -1398,8 +1399,6 @@ void THD::cleanup(void) trans_rollback(this); xid_cache_delete(&transaction.xid_state); - locked_tables_list.unlock_locked_tables(this); - DBUG_ASSERT(open_tables == NULL); /* If the thread was in the middle of an ongoing transaction (rolled |