1
0
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:
Sergey Vojtovich
2019-12-20 20:33:29 +04:00
parent 02619ed73b
commit 54c03cb4f0
3 changed files with 20 additions and 4 deletions

View File

@ -7946,10 +7946,8 @@ static bool mysql_inplace_alter_table(THD *thd,
// Rename altered table if requested. // Rename altered table if requested.
if (alter_ctx->is_table_renamed()) if (alter_ctx->is_table_renamed())
{ {
// Remove TABLE and TABLE_SHARE for old name from TDC. DBUG_ASSERT(!tdc_share_is_cached(thd, alter_ctx->db.str,
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, alter_ctx->table_name.str));
alter_ctx->db.str, alter_ctx->table_name.str);
if (mysql_rename_table(db_type, &alter_ctx->db, &alter_ctx->table_name, if (mysql_rename_table(db_type, &alter_ctx->db, &alter_ctx->table_name,
&alter_ctx->new_db, &alter_ctx->new_alias, 0)) &alter_ctx->new_db, &alter_ctx->new_alias, 0))
{ {

View File

@ -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. Get TABLE_SHARE for a table.

View File

@ -77,6 +77,7 @@ extern void tdc_purge(bool all);
extern TDC_element *tdc_lock_share(THD *thd, const char *db, extern TDC_element *tdc_lock_share(THD *thd, const char *db,
const char *table_name); const char *table_name);
extern void tdc_unlock_share(TDC_element *element); 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, extern TABLE_SHARE *tdc_acquire_share(THD *thd, TABLE_LIST *tl, uint flags,
TABLE **out_table= 0); TABLE **out_table= 0);
extern void tdc_release_share(TABLE_SHARE *share); extern void tdc_release_share(TABLE_SHARE *share);