mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge remote-tracking branch 'origin/10.4' into 10.5
This commit is contained in:
@ -504,6 +504,43 @@ static my_bool tc_collect_used_shares(TDC_element *element,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Ignore errors from opening read only tables
|
||||
*/
|
||||
|
||||
class flush_tables_error_handler : public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
int handled_errors;
|
||||
int unhandled_errors;
|
||||
flush_tables_error_handler() : handled_errors(0), unhandled_errors(0)
|
||||
{}
|
||||
|
||||
bool handle_condition(THD *thd,
|
||||
uint sql_errno,
|
||||
const char* sqlstate,
|
||||
Sql_condition::enum_warning_level *level,
|
||||
const char* msg,
|
||||
Sql_condition ** cond_hdl)
|
||||
{
|
||||
*cond_hdl= NULL;
|
||||
if (sql_errno == ER_OPEN_AS_READONLY)
|
||||
{
|
||||
handled_errors++;
|
||||
return TRUE;
|
||||
}
|
||||
if (*level == Sql_condition::WARN_LEVEL_ERROR)
|
||||
unhandled_errors++;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool got_fatal_error()
|
||||
{
|
||||
return unhandled_errors > 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Flush cached table as part of global read lock
|
||||
|
||||
@ -520,9 +557,9 @@ static my_bool tc_collect_used_shares(TDC_element *element,
|
||||
bool flush_tables(THD *thd, flush_tables_type flag)
|
||||
{
|
||||
bool result= TRUE;
|
||||
uint open_errors= 0;
|
||||
tc_collect_arg collect_arg;
|
||||
TABLE *tmp_table;
|
||||
flush_tables_error_handler error_handler;
|
||||
DBUG_ENTER("flush_tables");
|
||||
|
||||
purge_tables(false); /* Flush unused tables and shares */
|
||||
@ -555,6 +592,8 @@ bool flush_tables(THD *thd, flush_tables_type flag)
|
||||
}
|
||||
|
||||
/* Call HA_EXTRA_FLUSH on all found shares */
|
||||
|
||||
thd->push_internal_handler(&error_handler);
|
||||
for (uint i= 0 ; i < collect_arg.shares.elements ; i++)
|
||||
{
|
||||
TABLE_SHARE *share= *dynamic_element(&collect_arg.shares, i,
|
||||
@ -584,14 +623,14 @@ bool flush_tables(THD *thd, flush_tables_type flag)
|
||||
*/
|
||||
closefrm(tmp_table);
|
||||
}
|
||||
else
|
||||
open_errors++;
|
||||
}
|
||||
tdc_release_share(share);
|
||||
}
|
||||
|
||||
result= open_errors ? TRUE : FALSE;
|
||||
DBUG_PRINT("note", ("open_errors: %u", open_errors));
|
||||
thd->pop_internal_handler();
|
||||
result= error_handler.got_fatal_error();
|
||||
DBUG_PRINT("note", ("open_errors: %u %u",
|
||||
error_handler.handled_errors,
|
||||
error_handler.unhandled_errors));
|
||||
err:
|
||||
my_free(tmp_table);
|
||||
delete_dynamic(&collect_arg.shares);
|
||||
|
Reference in New Issue
Block a user