mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
5.5 merge
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user