Commit 02619ed7 authored by Sergey Vojtovich's avatar Sergey Vojtovich

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
parent e0743bd1
......@@ -388,13 +388,12 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
if (! table)
continue;
if (thd->mdl_context.upgrade_shared_lock(table->mdl_ticket, MDL_EXCLUSIVE,
timeout))
if (wait_while_table_is_used(thd, table,
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE))
{
result= true;
break;
}
table->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
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)
{
DBUG_ASSERT(!share->tmp_table);
DBUG_ASSERT(share->tdc->flushed);
char key[MAX_DBKEY_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;
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;
}
}
/* 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
*/
void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
bool action_completed,
bool drop_partition,
bool frm_install,
bool close_table)
static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
bool action_completed,
bool drop_partition,
bool frm_install,
bool close_table)
{
partition_info *part_info= lpt->part_info;
THD *thd= lpt->thd;
......
......@@ -2480,7 +2480,6 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
error= -1;
goto err;
}
/* the following internally does TDC_RT_REMOVE_ALL */
close_all_tables_for_name(thd, table->table->s,
HA_EXTRA_PREPARE_FOR_DROP, NULL);
table->table= 0;
......
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