diff options
author | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2015-08-25 14:25:46 +0530 |
---|---|---|
committer | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2015-08-25 14:25:46 +0530 |
commit | e414cbffad0e095c545cf2aa3f646c8a36c9b398 (patch) | |
tree | e33beec2ec8c00c95c6c0c405e4e9520bc235de4 /sql/sql_handler.cc | |
parent | f4ff086abea975222572fcfd232bf296018f5d85 (diff) | |
download | mariadb-git-e414cbffad0e095c545cf2aa3f646c8a36c9b398.tar.gz |
BUG#20449914: HANDLE_FATAL_SIGNAL (SIG=11) IN
FIELD_ITERATOR_TABLE::END_OF_FIELDS
Note: This a backport of the patch for bug#19894987
to MySQL-5.5
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index b179d54eadf..2d8877db37a 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1002,3 +1002,49 @@ void mysql_ha_set_explicit_lock_duration(THD *thd) DBUG_VOID_RETURN; } + +/** + Remove temporary tables from the HANDLER's hash table. The reason + for having a separate function, rather than calling + mysql_ha_rm_tables() is that it is not always feasible (e.g. in + close_temporary_tables) to obtain a TABLE_LIST containing the + temporary tables. + + @See close_temporary_tables + @param thd Thread identifier. +*/ +void mysql_ha_rm_temporary_tables(THD *thd) +{ + DBUG_ENTER("mysql_ha_rm_temporary_tables"); + + TABLE_LIST *tmp_handler_tables= NULL; + for (uint i= 0; i < thd->handler_tables_hash.records; i++) + { + TABLE_LIST *handler_table= reinterpret_cast<TABLE_LIST*> + (my_hash_element(&thd->handler_tables_hash, i)); + + if (handler_table->table && handler_table->table->s->tmp_table) + { + handler_table->next_local= tmp_handler_tables; + tmp_handler_tables= handler_table; + } + } + + while (tmp_handler_tables) + { + TABLE_LIST *nl= tmp_handler_tables->next_local; + mysql_ha_close_table(thd, tmp_handler_tables); + my_hash_delete(&thd->handler_tables_hash, (uchar*) tmp_handler_tables); + tmp_handler_tables= nl; + } + + /* + Mark MDL_context as no longer breaking protocol if we have + closed last HANDLER. + */ + if (thd->handler_tables_hash.records == 0) + { + thd->mdl_context.set_needs_thr_lock_abort(FALSE); + } + DBUG_VOID_RETURN; +} |