diff options
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 4bf6c13a7d8..84e2c3069c3 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1,5 +1,6 @@ /* - Copyright (c) 2002, 2011, Oracle and/or its affiliates. + Copyright (c) 2002, 2013, Oracle and/or its affiliates. + Copyright (c) 2011, 2013, Monty Program Ab 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 @@ -2102,10 +2103,18 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) close_thread_tables(thd); thd_proc_info(thd, 0); - if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode()) - thd->mdl_context.release_transactional_locks(); - else if (! thd->in_sub_stmt) - thd->mdl_context.release_statement_locks(); + if (! thd->in_sub_stmt) + { + if (thd->transaction_rollback_request) + { + trans_rollback_implicit(thd); + thd->mdl_context.release_transactional_locks(); + } + else if (! thd->in_multi_stmt_transaction_mode()) + thd->mdl_context.release_transactional_locks(); + else + thd->mdl_context.release_statement_locks(); + } thd->rollback_item_tree_changes(); @@ -2964,10 +2973,18 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, close_thread_tables(thd); thd_proc_info(thd, 0); - if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode()) - thd->mdl_context.release_transactional_locks(); - else if (! thd->in_sub_stmt) - thd->mdl_context.release_statement_locks(); + if (! thd->in_sub_stmt) + { + if (thd->transaction_rollback_request) + { + trans_rollback_implicit(thd); + thd->mdl_context.release_transactional_locks(); + } + else if (! thd->in_multi_stmt_transaction_mode()) + thd->mdl_context.release_transactional_locks(); + else + thd->mdl_context.release_statement_locks(); + } } //TODO: why is this here if log_slow_query is in sp_instr_stmt_execute? delete_explain_query(m_lex); |