From 742899e59d4d1c4ec8d32c140fe7ac4b134757e4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 7 Jun 2013 15:34:59 +0200 Subject: [PATCH] MDEV-4480 Assertion `inited == NONE' fails on closing a connection with open handler on temporary table --- mysql-test/suite/handler/disconnect_4480.result | 5 +++++ mysql-test/suite/handler/disconnect_4480.test | 10 ++++++++++ sql/sql_class.cc | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/handler/disconnect_4480.result create mode 100644 mysql-test/suite/handler/disconnect_4480.test diff --git a/mysql-test/suite/handler/disconnect_4480.result b/mysql-test/suite/handler/disconnect_4480.result new file mode 100644 index 00000000000..d0a67c72c05 --- /dev/null +++ b/mysql-test/suite/handler/disconnect_4480.result @@ -0,0 +1,5 @@ +create temporary table t1 as select 1; +handler t1 open; +handler t1 read next; +1 +1 diff --git a/mysql-test/suite/handler/disconnect_4480.test b/mysql-test/suite/handler/disconnect_4480.test new file mode 100644 index 00000000000..507249bd8bc --- /dev/null +++ b/mysql-test/suite/handler/disconnect_4480.test @@ -0,0 +1,10 @@ +# +# MDEV-4480 Assertion `inited == NONE' fails on closing a connection with open handler on temporary table +# + +--connect (con1,localhost,root,,) +create temporary table t1 as select 1; +handler t1 open; +handler t1 read next; +--disconnect con1 + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index ca17cefff4c..94e58473a5e 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1390,6 +1390,8 @@ void THD::cleanup(void) } #endif + mysql_ha_cleanup(this); + close_temporary_tables(this); transaction.xid_state.xa_state= XA_NOTR; @@ -1397,7 +1399,6 @@ void THD::cleanup(void) xid_cache_delete(&transaction.xid_state); locked_tables_list.unlock_locked_tables(this); - mysql_ha_cleanup(this); DBUG_ASSERT(open_tables == NULL); /*