mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Cleanup close_all_tables_for_name()
close_all_tables_for_name() is always preceded by wait_while_table_is_used(), which makes tdc_remove_table() redundant. The only (now fixed) exception was close_cached_tables(). Part of MDEV-17882 - Cleanup refresh version
This commit is contained in:
@ -388,13 +388,12 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
|
|||||||
if (! table)
|
if (! table)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (thd->mdl_context.upgrade_shared_lock(table->mdl_ticket, MDL_EXCLUSIVE,
|
if (wait_while_table_is_used(thd, table,
|
||||||
timeout))
|
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE))
|
||||||
{
|
{
|
||||||
result= true;
|
result= true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
table->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
|
|
||||||
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
|
close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -800,11 +799,10 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
|
|||||||
TABLE *skip_table)
|
TABLE *skip_table)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(!share->tmp_table);
|
DBUG_ASSERT(!share->tmp_table);
|
||||||
|
DBUG_ASSERT(share->tdc->flushed);
|
||||||
|
|
||||||
char key[MAX_DBKEY_LENGTH];
|
char key[MAX_DBKEY_LENGTH];
|
||||||
size_t key_length= share->table_cache_key.length;
|
size_t key_length= share->table_cache_key.length;
|
||||||
const char *db= key;
|
|
||||||
const char *table_name= db + share->db.length + 1;
|
|
||||||
bool remove_from_locked_tables= extra != HA_EXTRA_NOT_USED;
|
bool remove_from_locked_tables= extra != HA_EXTRA_NOT_USED;
|
||||||
|
|
||||||
memcpy(key, share->table_cache_key.str, key_length);
|
memcpy(key, share->table_cache_key.str, key_length);
|
||||||
@ -841,9 +839,6 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
|
|||||||
prev= &table->next;
|
prev= &table->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Remove the table share from the cache. */
|
|
||||||
if (skip_table == NULL)
|
|
||||||
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db, table_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6819,11 +6819,11 @@ static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
|
|||||||
@param close_table Table is still open, close it before reverting
|
@param close_table Table is still open, close it before reverting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
|
static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
|
||||||
bool action_completed,
|
bool action_completed,
|
||||||
bool drop_partition,
|
bool drop_partition,
|
||||||
bool frm_install,
|
bool frm_install,
|
||||||
bool close_table)
|
bool close_table)
|
||||||
{
|
{
|
||||||
partition_info *part_info= lpt->part_info;
|
partition_info *part_info= lpt->part_info;
|
||||||
THD *thd= lpt->thd;
|
THD *thd= lpt->thd;
|
||||||
|
@ -2480,7 +2480,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||||||
error= -1;
|
error= -1;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* the following internally does TDC_RT_REMOVE_ALL */
|
|
||||||
close_all_tables_for_name(thd, table->table->s,
|
close_all_tables_for_name(thd, table->table->s,
|
||||||
HA_EXTRA_PREPARE_FOR_DROP, NULL);
|
HA_EXTRA_PREPARE_FOR_DROP, NULL);
|
||||||
table->table= 0;
|
table->table= 0;
|
||||||
|
Reference in New Issue
Block a user