1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Split tdc_remove_table()

TDC_RT_REMOVE_ALL -> tdc_remove_table(). Some occurrences replaced with
TDC_element::flush() (whenver TABLE_SHARE is available).

TDC_RT_REMOVE_NOT_OWN[_KEEP_SHARE] -> TDC_element::flush(). These modes
assume that current thread owns TABLE_SHARE reference, which means we can
avoid hash lookup and flush unused TABLE instances directly.

TDC_RT_REMOVE_UNUSED -> TDC_element::flush_unused(). Only [ab]used by
mysql_admin_table() currently. Should be removed eventually.

Part of MDEV-17882 - Cleanup refresh version
This commit is contained in:
Sergey Vojtovich
2019-12-17 16:25:15 +04:00
parent 06fae75859
commit 7a947614fb
12 changed files with 127 additions and 144 deletions

View File

@ -442,8 +442,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
DBUG_RETURN(true);
for (TABLE_LIST *table= tables; table; table= table->next_local)
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db.str,
table->table_name.str);
tdc_remove_table(thd, table->db.str, table->table_name.str);
}
DBUG_RETURN(false);
}
@ -1310,8 +1309,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN,
table->s->db.str, table->s->table_name.str);
table->s->tdc->flush(thd, true);
/* extra() call must come only after all instances above are closed */
if (function != HA_EXTRA_NOT_USED)
(void) table->file->extra(function);
@ -1350,9 +1348,8 @@ void drop_open_table(THD *thd, TABLE *table, const LEX_CSTRING *db_name,
handlerton *table_type= table->s->db_type();
table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
table->s->tdc->flush(thd, true);
close_thread_table(thd, &thd->open_tables);
/* Remove the table share from the table cache. */
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, db_name->str, table_name->str);
/* Remove the table from the storage engine and rm the .frm. */
quick_rm_table(thd, table_type, db_name, table_name, 0);
}
@ -2947,8 +2944,7 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
tdc_release_share(share);
/* Remove the repaired share from the table cache. */
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
table_list->db.str, table_list->table_name.str);
tdc_remove_table(thd, table_list->db.str, table_list->table_name.str);
end_free:
my_free(entry);
return result;
@ -3119,7 +3115,7 @@ Open_table_context::recover_from_failed_open()
get_timeout(), 0)))
break;
tdc_remove_table(m_thd, TDC_RT_REMOVE_ALL, m_failed_table->db.str,
tdc_remove_table(m_thd, m_failed_table->db.str,
m_failed_table->table_name.str);
m_thd->get_stmt_da()->clear_warning_info(m_thd->query_id);
@ -3155,7 +3151,7 @@ Open_table_context::recover_from_failed_open()
get_timeout(), 0)))
break;
tdc_remove_table(m_thd, TDC_RT_REMOVE_ALL, m_failed_table->db.str,
tdc_remove_table(m_thd, m_failed_table->db.str,
m_failed_table->table_name.str);
result= auto_repair_table(m_thd, m_failed_table);