Commit 4bd8c634 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: don't repeat common code

parent 364e7a9a
...@@ -3103,11 +3103,10 @@ Open_table_context::recover_from_failed_open() ...@@ -3103,11 +3103,10 @@ Open_table_context::recover_from_failed_open()
switch (m_action) switch (m_action)
{ {
case OT_BACKOFF_AND_RETRY: case OT_BACKOFF_AND_RETRY:
break;
case OT_REOPEN_TABLES: case OT_REOPEN_TABLES:
break; break;
case OT_DISCOVER: case OT_DISCOVER:
{ case OT_REPAIR:
if ((result= lock_table_names(m_thd, m_thd->lex->create_info, if ((result= lock_table_names(m_thd, m_thd->lex->create_info,
m_failed_table, NULL, m_failed_table, NULL,
get_timeout(), 0))) get_timeout(), 0)))
...@@ -3116,6 +3115,10 @@ Open_table_context::recover_from_failed_open() ...@@ -3116,6 +3115,10 @@ Open_table_context::recover_from_failed_open()
tdc_remove_table(m_thd, m_failed_table->db.str, tdc_remove_table(m_thd, m_failed_table->db.str,
m_failed_table->table_name.str); m_failed_table->table_name.str);
switch (m_action)
{
case OT_DISCOVER:
{
m_thd->get_stmt_da()->clear_warning_info(m_thd->query_id); m_thd->get_stmt_da()->clear_warning_info(m_thd->query_id);
m_thd->clear_error(); // Clear error message m_thd->clear_error(); // Clear error message
...@@ -3133,26 +3136,16 @@ Open_table_context::recover_from_failed_open() ...@@ -3133,26 +3136,16 @@ Open_table_context::recover_from_failed_open()
if (result && no_such_table_handler.safely_trapped_errors()) if (result && no_such_table_handler.safely_trapped_errors())
result= FALSE; result= FALSE;
} }
/*
Rollback to start of the current statement to release exclusive lock
on table which was discovered but preserve locks from previous statements
in current transaction.
*/
m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
break; break;
} }
case OT_REPAIR: case OT_REPAIR:
{
if ((result= lock_table_names(m_thd, m_thd->lex->create_info,
m_failed_table, NULL,
get_timeout(), 0)))
break;
tdc_remove_table(m_thd, m_failed_table->db.str,
m_failed_table->table_name.str);
result= auto_repair_table(m_thd, m_failed_table); result= auto_repair_table(m_thd, m_failed_table);
break;
case OT_BACKOFF_AND_RETRY:
case OT_REOPEN_TABLES:
case OT_NO_ACTION:
DBUG_ASSERT(0);
}
/* /*
Rollback to start of the current statement to release exclusive lock Rollback to start of the current statement to release exclusive lock
on table which was discovered but preserve locks from previous statements on table which was discovered but preserve locks from previous statements
...@@ -3160,8 +3153,7 @@ Open_table_context::recover_from_failed_open() ...@@ -3160,8 +3153,7 @@ Open_table_context::recover_from_failed_open()
*/ */
m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp()); m_thd->mdl_context.rollback_to_savepoint(start_of_statement_svp());
break; break;
} case OT_NO_ACTION:
default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
m_thd->pop_internal_handler(); m_thd->pop_internal_handler();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment