diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-11-23 00:50:54 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-11-23 00:50:54 +0100 |
commit | c6d30805db3a1a2a098c3009fde8a42efd9fb9de (patch) | |
tree | e55f68e5adf40e1a75e08bda91b712ab6a094643 /sql/sql_base.cc | |
parent | 2c032b990e4ec470fad2e9f61cf6267a68b7e937 (diff) | |
parent | eea310e498f3b7ac95a4492d48f04e08d3009412 (diff) | |
download | mariadb-git-c6d30805db3a1a2a098c3009fde8a42efd9fb9de.tar.gz |
5.5 merge
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 34737f0dca0..3f4be0da25d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2011 Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2010, 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 @@ -3905,7 +3905,8 @@ end_free: /** Open_table_context */ Open_table_context::Open_table_context(THD *thd, uint flags) - :m_failed_table(NULL), + :m_thd(thd), + m_failed_table(NULL), m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()), m_timeout(flags & MYSQL_LOCK_IGNORE_TIMEOUT ? LONG_TIMEOUT : thd->variables.lock_wait_timeout), @@ -3982,6 +3983,7 @@ request_backoff_action(enum_open_table_action action_arg, if (action_arg != OT_REOPEN_TABLES && m_has_locks) { my_error(ER_LOCK_DEADLOCK, MYF(0)); + mark_transaction_to_rollback(m_thd, true); return TRUE; } /* @@ -3991,7 +3993,7 @@ request_backoff_action(enum_open_table_action action_arg, if (table) { DBUG_ASSERT(action_arg == OT_DISCOVER || action_arg == OT_REPAIR); - m_failed_table= (TABLE_LIST*) current_thd->alloc(sizeof(TABLE_LIST)); + m_failed_table= (TABLE_LIST*) m_thd->alloc(sizeof(TABLE_LIST)); if (m_failed_table == NULL) return TRUE; m_failed_table->init_one_table(table->db, table->db_length, @@ -4008,8 +4010,6 @@ request_backoff_action(enum_open_table_action action_arg, /** Recover from failed attempt of open table by performing requested action. - @param thd Thread context - @pre This function should be called only with "action" != OT_NO_ACTION and after having called @sa close_tables_for_reopen(). @@ -4019,7 +4019,7 @@ request_backoff_action(enum_open_table_action action_arg, bool Open_table_context:: -recover_from_failed_open(THD *thd) +recover_from_failed_open() { bool result= FALSE; /* Execute the action. */ @@ -4031,38 +4031,38 @@ recover_from_failed_open(THD *thd) break; case OT_DISCOVER: { - if ((result= lock_table_names(thd, m_failed_table, NULL, + if ((result= lock_table_names(m_thd, m_failed_table, NULL, get_timeout(), MYSQL_OPEN_SKIP_TEMPORARY))) break; - tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db, + tdc_remove_table(m_thd, TDC_RT_REMOVE_ALL, m_failed_table->db, m_failed_table->table_name, FALSE); - thd->warning_info->clear_warning_info(thd->query_id); - thd->clear_error(); // Clear error message + m_thd->warning_info->clear_warning_info(m_thd->query_id); + m_thd->clear_error(); // Clear error message if ((result= - !get_table_share(thd, m_failed_table->db, + !get_table_share(m_thd, m_failed_table->db, m_failed_table->table_name, GTS_TABLE | GTS_FORCE_DISCOVERY | GTS_NOLOCK))) break; - thd->mdl_context.release_transactional_locks(); + m_thd->mdl_context.release_transactional_locks(); break; } case OT_REPAIR: { - if ((result= lock_table_names(thd, m_failed_table, NULL, + if ((result= lock_table_names(m_thd, m_failed_table, NULL, get_timeout(), MYSQL_OPEN_SKIP_TEMPORARY))) break; - tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db, + tdc_remove_table(m_thd, TDC_RT_REMOVE_ALL, m_failed_table->db, m_failed_table->table_name, FALSE); - result= auto_repair_table(thd, m_failed_table); - thd->mdl_context.release_transactional_locks(); + result= auto_repair_table(m_thd, m_failed_table); + m_thd->mdl_context.release_transactional_locks(); break; } default: @@ -4981,7 +4981,7 @@ restart: TABLE_LIST element. Altough currently this assumption is valid it may change in future. */ - if (ot_ctx.recover_from_failed_open(thd)) + if (ot_ctx.recover_from_failed_open()) goto err; error= FALSE; @@ -5034,7 +5034,7 @@ restart: { close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp()); - if (ot_ctx.recover_from_failed_open(thd)) + if (ot_ctx.recover_from_failed_open()) goto err; error= FALSE; @@ -5473,7 +5473,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type, */ thd->mdl_context.rollback_to_savepoint(ot_ctx.start_of_statement_svp()); table_list->mdl_request.ticket= 0; - if (ot_ctx.recover_from_failed_open(thd)) + if (ot_ctx.recover_from_failed_open()) break; } |