From 24d9664ad0c594ba76c0a134a5e07799f097b57a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 29 Sep 2017 16:44:53 +0000 Subject: In table cache code, fix casts from longlong to long for 'version' variables. The warnings occur on Windows build, yet they are also are valid on 32bit Unix. Fix is to consistently use 64bit integer on all platforms. --- sql/table_cache.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sql/table_cache.cc') diff --git a/sql/table_cache.cc b/sql/table_cache.cc index 8c14b60e73c..be990543757 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -68,7 +68,7 @@ I_P_List > unused_shares; -static int64 tdc_version; /* Increments on each reload */ +static tdc_version_t tdc_version; /* Increments on each reload */ static bool tdc_inited; @@ -945,7 +945,7 @@ 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: %lu", + ("share: %p table: %s.%s ref_count: %u version: %lld", share, share->db.str, share->table_name.str, share->tdc->ref_count, share->tdc->version)); DBUG_ASSERT(share->tdc->ref_count); @@ -1181,8 +1181,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, - ulong refresh_version) + ulong wait_timeout, uint deadlock_weight, tdc_version_t refresh_version) { TDC_element *element; @@ -1201,16 +1200,16 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name, } -ulong tdc_refresh_version(void) +tdc_version_t tdc_refresh_version(void) { - return (ulong)my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED); + return (tdc_version_t)my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED); } -ulong tdc_increment_refresh_version(void) +tdc_version_t tdc_increment_refresh_version(void) { - ulong v= (ulong)my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED); - DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", v)); + 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; } -- cgit v1.2.1