summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-06-19 18:20:49 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-10-10 16:09:27 +0400
commitfbfc8612e97845c273e52c6c6b036fdb792467b4 (patch)
tree1a679ee72dded2793aa2ea0cc981c79ea5a34435
parentf212548fde30e2486411f039a9b72ed575072f2d (diff)
downloadmariadb-git-bb-10.4-svoj-MDEV-17882.tar.gz
Removed tc_purge() and purge_tables() argumentbb-10.4-svoj-MDEV-17882
It was mistakenly used by tdc_start_shutdown() to make sure TABLE_SHARE gets evicted from table definition cache when it becomes unused. However same effect is achieved by resetting tdc_size and tc_size. Part of MDEV-17882 - Cleanup refresh version
-rw-r--r--sql/backup.cc2
-rw-r--r--sql/sql_base.cc12
-rw-r--r--sql/sql_base.h2
-rw-r--r--sql/table_cache.cc6
-rw-r--r--sql/table_cache.h2
5 files changed, 10 insertions, 14 deletions
diff --git a/sql/backup.cc b/sql/backup.cc
index 73cd13ffe2a..a44e12102c1 100644
--- a/sql/backup.cc
+++ b/sql/backup.cc
@@ -204,7 +204,7 @@ static bool backup_flush(THD *thd)
Free unused tables and table shares so that mariabackup knows what
is safe to copy
*/
- tc_purge(false);
+ tc_purge();
tdc_purge(true);
DBUG_RETURN(0);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 737632c345c..2d58b1ce390 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -312,13 +312,9 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
/**
Close all tables that are not in use in table definition cache
-
- @param purge_flag Argument for tc_purge. true if we should force all
- shares to be deleted. false if it's enough to just
- evict those that are not in use.
*/
-void purge_tables(bool purge_flag)
+void purge_tables()
{
/*
Force close of all open tables.
@@ -332,7 +328,7 @@ void purge_tables(bool purge_flag)
Get rid of all unused TABLE and TABLE_SHARE instances. By doing
this we automatically close all tables which were marked as "old".
*/
- tc_purge(purge_flag);
+ tc_purge();
/* Free table shares which were not freed implicitly by loop above. */
tdc_purge(true);
}
@@ -361,7 +357,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
if (!tables)
{
/* Free tables that are not used */
- purge_tables(false);
+ purge_tables();
if (!wait_for_refresh)
DBUG_RETURN(false);
}
@@ -562,7 +558,7 @@ bool flush_tables(THD *thd, flush_tables_type flag)
flush_tables_error_handler error_handler;
DBUG_ENTER("flush_tables");
- purge_tables(false); /* Flush unused tables and shares */
+ purge_tables(); /* Flush unused tables and shares */
/*
Loop over all shares and collect shares that have open tables
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 28a787c56dd..f390c00aa05 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -298,7 +298,7 @@ void close_log_table(THD *thd, Open_tables_backup *backup);
bool close_cached_tables(THD *thd, TABLE_LIST *tables,
bool wait_for_refresh, ulong timeout);
-void purge_tables(bool purge_flag);
+void purge_tables();
bool flush_tables(THD *thd, flush_tables_type flag);
bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connect_string);
void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 4b88be421fe..8e5c3a8471d 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -323,12 +323,12 @@ static my_bool tc_purge_callback(TDC_element *element, tc_purge_arg *arg)
}
-void tc_purge(bool mark_flushed)
+void tc_purge()
{
tc_purge_arg argument;
TABLE *table;
- argument.mark_flushed= mark_flushed;
+ argument.mark_flushed= false;
tdc_iterate(0, (my_hash_walk_action) tc_purge_callback, &argument);
while ((table= argument.purge_tables.pop_front()))
intern_close_table(table);
@@ -655,7 +655,7 @@ void tdc_start_shutdown(void)
tdc_size= 0;
tc_size= 0;
/* Free all cached but unused TABLEs and TABLE_SHAREs. */
- purge_tables(true);
+ purge_tables();
}
DBUG_VOID_RETURN;
}
diff --git a/sql/table_cache.h b/sql/table_cache.h
index 175f25a5e28..f971c377992 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -91,7 +91,7 @@ extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
bool no_dups= false);
extern uint tc_records(void);
-extern void tc_purge(bool mark_flushed= false);
+extern void tc_purge();
extern void tc_add_table(THD *thd, TABLE *table);
extern void tc_release_table(TABLE *table);
extern TABLE *tc_acquire_table(THD *thd, TDC_element *element);