diff options
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 654d7ad718d..7252f078f81 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -995,8 +995,18 @@ void THD::cleanup(void) trans_rollback(this); xid_cache_delete(&transaction.xid_state); } + locked_tables_list.unlock_locked_tables(this); + /* + If the thread was in the middle of an ongoing transaction (rolled + back a few lines above) or under LOCK TABLES (unlocked the tables + and left the mode a few lines above), there will be outstanding + metadata locks. Release them. + */ + DBUG_ASSERT(open_tables == NULL); + mdl_context.release_all_locks(); + #if defined(ENABLED_DEBUG_SYNC) /* End the Debug Sync Facility. See debug_sync.cc. */ debug_sync_end_thread(this); |