summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-06-19 14:59:36 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-11-25 18:49:51 +0400
commit0aa807d10051e1231bf3d4457db16ad8e66111aa (patch)
tree4c4a698a8d8ccaad6ef4991c709e552fe06c616e
parent0c05a2ed71ebf408e32f7fcdd358d756948d8a5d (diff)
downloadmariadb-git-0aa807d10051e1231bf3d4457db16ad8e66111aa.tar.gz
Removed tdc_increment_refresh_version()
It is never called after 7fb9d64, which makes the whole refresh version infrastructure useless. Removed: - tdc_version_t - TDC_VERSION_MAX - tdc_version - TDC_element::version - tdc_increment_refresh_version() - tdc_refresh_version() - refresh_version argument of tdc_wait_for_old_version() - Flush_commands status variable - refresh version from COM_STATISTICS - refresh version from dbug printouts Part of MDEV-17882 - Cleanup refresh version
-rw-r--r--sql/mysqld.cc11
-rw-r--r--sql/sql_base.cc6
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/table_cache.cc25
-rw-r--r--sql/table_cache.h8
6 files changed, 8 insertions, 47 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b3fb330f13c..59c37da2de8 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7050,16 +7050,6 @@ static int show_table_definitions(THD *thd, SHOW_VAR *var, char *buff,
}
-static int show_flush_commands(THD *thd, SHOW_VAR *var, char *buff,
- enum enum_var_type scope)
-{
- var->type= SHOW_LONGLONG;
- var->value= buff;
- *((longlong *) buff)= (longlong)tdc_refresh_version();
- return 0;
-}
-
-
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/*
@@ -7439,7 +7429,6 @@ SHOW_VAR status_vars[]= {
{"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
{"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS},
{"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
- {"Flush_commands", (char*) &show_flush_commands, SHOW_SIMPLE_FUNC},
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS},
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index da061adfc1f..4b0fe1eb5d1 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1404,9 +1404,9 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
{
DBUG_ENTER("wait_while_table_is_used");
DBUG_ASSERT(!table->s->tmp_table);
- DBUG_PRINT("enter", ("table: '%s' share: %p db_stat: %u version: %lld",
+ DBUG_PRINT("enter", ("table: '%s' share: %p db_stat: %u",
table->s->table_name.str, table->s,
- table->db_stat, table->s->tdc->version));
+ table->db_stat));
if (thd->mdl_context.upgrade_shared_lock(
table->mdl_ticket, MDL_EXCLUSIVE,
@@ -2013,8 +2013,6 @@ retry_share:
{
if (share->tdc->flushed)
{
- DBUG_PRINT("info", ("Found old share version: %lld current: %lld",
- share->tdc->version, tdc_refresh_version()));
/*
We already have an MDL lock. But we have encountered an old
version of table in the table definition cache which is possible
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7f33f288ce3..b9f080fdde2 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2223,13 +2223,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
my_snprintf(buff, buff_len - 1,
"Uptime: %lu Threads: %d Questions: %lu "
- "Slow queries: %lu Opens: %lu Flush tables: %lld "
+ "Slow queries: %lu Opens: %lu "
"Open tables: %u Queries per second avg: %u.%03u",
uptime,
(int) thread_count, (ulong) thd->query_id,
current_global_status_var->long_query_count,
current_global_status_var->opened_tables,
- tdc_refresh_version(),
tc_records(),
(uint) (queries_per_second1000 / 1000),
(uint) (queries_per_second1000 % 1000));
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 68d30d5fecb..c5d8b336e38 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -110,8 +110,6 @@ static void print_cached_tables(void)
tdc_iterate(0, (my_hash_walk_action) print_cached_tables_callback, NULL, true);
- printf("\nCurrent refresh version: %ld\n",
- (long) tdc_refresh_version());
fflush(stdout);
/* purecov: end */
return;
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 0743525b944..15afe9bfed1 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -68,7 +68,6 @@ I_P_List <TDC_element,
I_P_List_null_counter,
I_P_List_fast_push_back<TDC_element> > unused_shares;
-static tdc_version_t tdc_version; /* Increments on each reload */
static bool tdc_inited;
@@ -624,7 +623,6 @@ bool tdc_init(void)
tdc_inited= true;
mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares,
MY_MUTEX_INIT_FAST);
- tdc_version= 1L; /* Increments on each reload */
lf_hash_init(&tdc_hash, sizeof(TDC_element) +
sizeof(Share_free_tables) * (tc_instances - 1),
LF_HASH_UNIQUE, 0, 0,
@@ -850,7 +848,6 @@ retry:
element->share= share;
share->tdc= element;
element->ref_count++;
- element->version= tdc_refresh_version();
element->flushed= false;
mysql_mutex_unlock(&element->LOCK_table_share);
@@ -965,9 +962,9 @@ void tdc_release_share(TABLE_SHARE *share)
mysql_mutex_lock(&share->tdc->LOCK_table_share);
DBUG_PRINT("enter",
- ("share: %p table: %s.%s ref_count: %u version: %lld",
+ ("share: %p table: %s.%s ref_count: %u",
share, share->db.str, share->table_name.str,
- share->tdc->ref_count, share->tdc->version));
+ share->tdc->ref_count));
DBUG_ASSERT(share->tdc->ref_count);
if (share->tdc->ref_count > 1)
@@ -1217,7 +1214,7 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
*/
int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
- ulong wait_timeout, uint deadlock_weight, tdc_version_t refresh_version)
+ ulong wait_timeout, uint deadlock_weight)
{
TDC_element *element;
@@ -1225,7 +1222,7 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
return FALSE;
else if (element == MY_ERRPTR)
return TRUE;
- else if (element->flushed && refresh_version > element->version)
+ else if (element->flushed)
{
struct timespec abstime;
set_timespec(abstime, wait_timeout);
@@ -1236,20 +1233,6 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
}
-tdc_version_t tdc_refresh_version(void)
-{
- return (tdc_version_t)my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
-}
-
-
-tdc_version_t tdc_increment_refresh_version(void)
-{
- tdc_version_t v= (tdc_version_t)my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
- DBUG_PRINT("tcache", ("incremented global refresh_version to: %lld", v));
- return v + 1;
-}
-
-
/**
Iterate table definition cache.
diff --git a/sql/table_cache.h b/sql/table_cache.h
index 611980c615f..05a1803cc50 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -26,14 +26,11 @@ struct Share_free_tables
char pad[CPU_LEVEL1_DCACHE_LINESIZE];
};
-typedef int64 tdc_version_t;
-#define TDC_VERSION_MAX INT_MAX64
struct TDC_element
{
uchar m_key[NAME_LEN + 1 + NAME_LEN + 1];
uint m_key_length;
- tdc_version_t version;
bool flushed;
TABLE_SHARE *share;
@@ -90,10 +87,7 @@ extern bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
extern int tdc_wait_for_old_version(THD *thd, const char *db,
const char *table_name,
- ulong wait_timeout, uint deadlock_weight,
- tdc_version_t refresh_version= TDC_VERSION_MAX);
-extern tdc_version_t tdc_refresh_version(void);
-extern tdc_version_t tdc_increment_refresh_version(void);
+ ulong wait_timeout, uint deadlock_weight);
extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
bool no_dups= false);