1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with next-4284.

This commit is contained in:
Konstantin Osipov
2009-12-10 11:41:03 +03:00
22 changed files with 493 additions and 228 deletions

View File

@ -1780,16 +1780,16 @@ void write_bin_log(THD *thd, bool clear_error,
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary)
{
bool error= FALSE, need_start_waiting= FALSE;
bool error;
Drop_table_error_handler err_handler(thd->get_internal_handler());
DBUG_ENTER("mysql_rm_table");
/* mark for close and remove all cached entries */
if (!drop_temporary)
{
if (!thd->locked_tables_mode &&
!(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))
if (!thd->locked_tables_mode && wait_if_global_read_lock(thd, 0, 1))
DBUG_RETURN(TRUE);
}
@ -1797,8 +1797,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
error= mysql_rm_table_part2(thd, tables, if_exists, drop_temporary, 0, 0);
thd->pop_internal_handler();
if (need_start_waiting)
if (thd->global_read_lock_protection > 0)
start_waiting_global_read_lock(thd);
if (error)
@ -4549,6 +4548,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
char table_name[NAME_LEN*2+2];
char* db = table->db;
bool fatal_error=0;
bool open_error;
DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name));
DBUG_PRINT("admin", ("extra_open_options: %u", extra_open_options));
@ -4576,12 +4576,22 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (view_operator_func == NULL)
table->required_type=FRMTYPE_TABLE;
open_and_lock_tables_derived(thd, table, TRUE,
MYSQL_OPEN_TAKE_UPGRADABLE_MDL);
open_error= open_and_lock_tables_derived(thd, table, TRUE,
MYSQL_OPEN_TAKE_UPGRADABLE_MDL);
thd->no_warnings_for_error= 0;
table->next_global= save_next_global;
table->next_local= save_next_local;
thd->open_options&= ~extra_open_options;
/*
Under locked tables, we know that the table can be opened,
so any errors opening the table are logical errors.
In these cases it does not make sense to try to repair.
*/
if (open_error && thd->locked_tables_mode)
{
result_code= HA_ADMIN_FAILED;
goto send_result;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table->table)
{