mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Cleanup mysql_inplace_alter_table()
Removed redundant tdc_remove_table(TDC_RT_REMOVE_ALL). Share was marked flushed by preceding wait_while_table_is_used() and eventually flushed by close_all_tables_for_name(). Part of MDEV-17882 - Cleanup refresh version
This commit is contained in:
@ -7946,10 +7946,8 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
// Rename altered table if requested.
|
||||
if (alter_ctx->is_table_renamed())
|
||||
{
|
||||
// Remove TABLE and TABLE_SHARE for old name from TDC.
|
||||
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
|
||||
alter_ctx->db.str, alter_ctx->table_name.str);
|
||||
|
||||
DBUG_ASSERT(!tdc_share_is_cached(thd, alter_ctx->db.str,
|
||||
alter_ctx->table_name.str));
|
||||
if (mysql_rename_table(db_type, &alter_ctx->db, &alter_ctx->table_name,
|
||||
&alter_ctx->new_db, &alter_ctx->new_alias, 0))
|
||||
{
|
||||
|
@ -776,6 +776,23 @@ void tdc_unlock_share(TDC_element *element)
|
||||
}
|
||||
|
||||
|
||||
int tdc_share_is_cached(THD *thd, const char *db, const char *table_name)
|
||||
{
|
||||
char key[MAX_DBKEY_LENGTH];
|
||||
|
||||
if (unlikely(fix_thd_pins(thd)))
|
||||
return -1;
|
||||
|
||||
if (lf_hash_search(&tdc_hash, thd->tdc_hash_pins, (uchar*) key,
|
||||
tdc_create_key(key, db, table_name)))
|
||||
{
|
||||
lf_hash_search_unpin(thd->tdc_hash_pins);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Get TABLE_SHARE for a table.
|
||||
|
||||
|
@ -77,6 +77,7 @@ extern void tdc_purge(bool all);
|
||||
extern TDC_element *tdc_lock_share(THD *thd, const char *db,
|
||||
const char *table_name);
|
||||
extern void tdc_unlock_share(TDC_element *element);
|
||||
int tdc_share_is_cached(THD *thd, const char *db, const char *table_name);
|
||||
extern TABLE_SHARE *tdc_acquire_share(THD *thd, TABLE_LIST *tl, uint flags,
|
||||
TABLE **out_table= 0);
|
||||
extern void tdc_release_share(TABLE_SHARE *share);
|
||||
|
Reference in New Issue
Block a user