summaryrefslogtreecommitdiff
path: root/sql/table_cache.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-09-26 20:49:51 +0200
committerSergei Golubchik <serg@mariadb.org>2018-09-28 16:37:06 +0200
commit57e0da50bbef8164635317785b67dd468a908327 (patch)
tree89d1ed179afce8b040c8f2dfcfe179042ff27b2e /sql/table_cache.cc
parent7aba6f8f8853acd18d471793f8b72aa1412b8151 (diff)
parentdcbd51cee628d8d8fec9ff5476a6afc855b007aa (diff)
downloadmariadb-git-57e0da50bbef8164635317785b67dd468a908327.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/table_cache.cc')
-rw-r--r--sql/table_cache.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 61e54c8f0f9..cb9583a2440 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -50,7 +50,6 @@
#include "lf.h"
#include "table.h"
#include "sql_base.h"
-#include "sql_statistics.h"
/** Configuration. */
@@ -464,6 +463,7 @@ void tc_release_table(TABLE *table)
DBUG_ENTER("tc_release_table");
DBUG_ASSERT(table->in_use);
DBUG_ASSERT(table->file);
+ DBUG_ASSERT(!table->pos_in_locked_tables);
mysql_mutex_lock(&tc[i].LOCK_table_cache);
if (table->needs_reopen() || table->s->tdc->flushed ||
@@ -992,7 +992,6 @@ void tdc_release_share(TABLE_SHARE *share)
}
if (share->tdc->flushed || tdc_records() > tdc_size)
{
- delete_stat_values_for_table_share(share);
mysql_mutex_unlock(&LOCK_unused_shares);
tdc_delete_share_from_hash(share->tdc);
DBUG_VOID_RETURN;
@@ -1142,11 +1141,10 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
All_share_tables_list::Iterator it(element->all_tables);
while ((table= it++))
{
- my_refs++;
- DBUG_ASSERT(table->in_use == thd);
+ if (table->in_use == thd)
+ my_refs++;
}
}
- DBUG_ASSERT(element->all_tables.is_empty() || remove_type != TDC_RT_REMOVE_ALL);
mysql_mutex_unlock(&element->LOCK_table_share);
while ((table= purge_tables.pop_front()))
@@ -1178,6 +1176,17 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
mysql_mutex_lock(&element->LOCK_table_share);
while (element->ref_count > my_refs)
mysql_cond_wait(&element->COND_release, &element->LOCK_table_share);
+ DBUG_ASSERT(element->all_tables.is_empty() ||
+ remove_type != TDC_RT_REMOVE_ALL);
+#ifndef DBUG_OFF
+ if (remove_type == TDC_RT_REMOVE_NOT_OWN ||
+ remove_type == TDC_RT_REMOVE_NOT_OWN_KEEP_SHARE)
+ {
+ All_share_tables_list::Iterator it(element->all_tables);
+ while ((table= it++))
+ DBUG_ASSERT(table->in_use == thd);
+ }
+#endif
mysql_mutex_unlock(&element->LOCK_table_share);
}