1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-4786 merge 10.0-monty -> 10.0

remove TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE
This commit is contained in:
Sergei Golubchik
2013-08-12 15:46:35 +02:00
parent eafb11c821
commit 9747fbb411
10 changed files with 16 additions and 128 deletions

View File

@ -1062,7 +1062,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
if (share)
{
kill_delayed_threads_for_table(share);
/* tdc_remove_table() calls share->remove_from_cache_at_close() */
/* tdc_remove_table() also sets TABLE_SHARE::version to 0. */
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db,
table->table_name, TRUE);
found=1;
@ -2333,8 +2333,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
*/
bool wait_while_table_is_used(THD *thd, TABLE *table,
enum ha_extra_function function,
enum_tdc_remove_table_type remove_type)
enum ha_extra_function function)
{
DBUG_ENTER("wait_while_table_is_used");
DBUG_PRINT("enter", ("table: '%s' share: 0x%lx db_stat: %u version: %lu",
@ -2346,7 +2345,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
tdc_remove_table(thd, remove_type,
tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN,
table->s->db.str, table->s->table_name.str,
FALSE);
/* extra() call must come only after all instances above are closed */
@ -2987,8 +2986,7 @@ retry_share:
}
mysql_mutex_lock(&LOCK_open);
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH) ||
(share->protected_against_usage() && !(flags & MYSQL_OPEN_FOR_REPAIR)))
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
{
if (share->has_old_version())
{
@ -9584,8 +9582,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
{
DBUG_ASSERT(share->used_tables.is_empty());
}
else if (remove_type == TDC_RT_REMOVE_NOT_OWN ||
remove_type == TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)
else if (remove_type == TDC_RT_REMOVE_NOT_OWN)
{
TABLE_SHARE::TABLE_list::Iterator it2(share->used_tables);
while ((table= it2++))
@ -9598,8 +9595,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
}
#endif
/*
Mark share to ensure that it gets automatically deleted once
it is no longer referenced.
Set share's version to zero in order to ensure that it gets
automatically deleted once it is no longer referenced.
Note that code in TABLE_SHARE::wait_for_old_version() assumes
that marking share as old and removal of its unused tables
@ -9608,13 +9605,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
TDC does not contain old shares which don't have any tables
used.
*/
if (remove_type == TDC_RT_REMOVE_NOT_OWN)
share->remove_from_cache_at_close();
else if (remove_type != TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE)
{
/* Ensure that no can open the table while it's used */
share->protect_against_usage();
}
if (remove_type != TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE)
share->version= 0;
while ((table= it++))
free_cache_entry(table);