Skip to content
Permalink
Browse files
Removed tc_purge() and purge_tables() argument
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
  • Loading branch information
Sergey Vojtovich committed Nov 25, 2019
1 parent 092834c commit 38c2c16
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
@@ -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);
@@ -311,13 +311,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.
@@ -331,7 +327,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);
}
@@ -360,7 +356,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);
}
@@ -561,7 +557,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
@@ -299,7 +299,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,
@@ -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;
}
@@ -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);

0 comments on commit 38c2c16

Please sign in to comment.