Commit 7e31cfda authored by Monty's avatar Monty

Errors from failed drop tables where ignored by atomic ddl.

parent 40ae9c5d
......@@ -910,9 +910,10 @@ class ddl_log_error_handler : public Internal_error_handler
int handled_errors;
int unhandled_errors;
int first_error;
bool only_ignore_non_existing_errors;
ddl_log_error_handler() : handled_errors(0), unhandled_errors(0),
first_error(0)
first_error(0), only_ignore_non_existing_errors(0)
{}
bool handle_condition(THD *thd,
......@@ -923,8 +924,10 @@ class ddl_log_error_handler : public Internal_error_handler
Sql_condition ** cond_hdl)
{
*cond_hdl= NULL;
if (non_existing_table_error(sql_errno) || sql_errno == EE_LINK ||
sql_errno == EE_DELETE || sql_errno == ER_TRG_NO_DEFINER)
if (non_existing_table_error(sql_errno) ||
(!only_ignore_non_existing_errors &&
(sql_errno == EE_LINK ||
sql_errno == EE_DELETE || sql_errno == ER_TRG_NO_DEFINER)))
{
handled_errors++;
return TRUE;
......@@ -936,7 +939,6 @@ class ddl_log_error_handler : public Internal_error_handler
unhandled_errors++;
return FALSE;
}
bool safely_trapped_errors()
{
return (handled_errors > 0 && unhandled_errors == 0);
......@@ -1537,7 +1539,10 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
case DDL_DROP_PHASE_TABLE:
if (hton)
{
if ((error= hton->drop_table(hton, path.str)))
no_such_table_handler.only_ignore_non_existing_errors= 1;
error= hton->drop_table(hton, path.str);
no_such_table_handler.only_ignore_non_existing_errors= 0;
if (error)
{
if (!non_existing_table_error(error))
break;
......@@ -2285,6 +2290,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
end:
delete file;
/* We are only interested in errors that where not ignored */
if ((error= (no_such_table_handler.unhandled_errors > 0)))
my_errno= no_such_table_handler.first_error;
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