summaryrefslogtreecommitdiff
path: root/sql/table_cache.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-01-12 17:03:45 +0100
committerSergei Golubchik <serg@mariadb.org>2015-01-13 10:15:21 +0100
commite695db0f2d97cbba2832e0f3dc25af5add1f16ac (patch)
tree7c03822a83a0b16ae513b22659b9ac43068b0411 /sql/table_cache.cc
parent1f0ad6c6b3421a815ea6373c66aaf693852342cf (diff)
downloadmariadb-git-e695db0f2d97cbba2832e0f3dc25af5add1f16ac.tar.gz
MDEV-7437 remove suport for "atomics" with rwlocks
Diffstat (limited to 'sql/table_cache.cc')
-rw-r--r--sql/table_cache.cc22
1 files changed, 2 insertions, 20 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index f12c031f91a..9a75cafb30e 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -82,7 +82,6 @@ static int32 tc_count; /**< Number of TABLE objects in table cache. */
*/
static mysql_mutex_t LOCK_unused_shares;
-my_atomic_rwlock_t LOCK_tdc_atomics; /**< Protects tdc_version. */
#ifdef HAVE_PSI_INTERFACE
PSI_mutex_key key_LOCK_unused_shares, key_TABLE_SHARE_LOCK_table_share;
@@ -136,11 +135,7 @@ static int fix_thd_pins(THD *thd)
uint tc_records(void)
{
- uint count;
- my_atomic_rwlock_rdlock(&LOCK_tdc_atomics);
- count= my_atomic_load32_explicit(&tc_count, MY_MEMORY_ORDER_RELAXED);
- my_atomic_rwlock_rdunlock(&LOCK_tdc_atomics);
- return count;
+ return my_atomic_load32_explicit(&tc_count, MY_MEMORY_ORDER_RELAXED);
}
@@ -153,9 +148,7 @@ uint tc_records(void)
static void tc_remove_table(TABLE *table)
{
- my_atomic_rwlock_wrlock(&LOCK_tdc_atomics);
my_atomic_add32_explicit(&tc_count, -1, MY_MEMORY_ORDER_RELAXED);
- my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics);
table->s->tdc->all_tables.remove(table);
}
@@ -262,10 +255,8 @@ void tc_add_table(THD *thd, TABLE *table)
mysql_mutex_unlock(&table->s->tdc->LOCK_table_share);
/* If we have too many TABLE instances around, try to get rid of them */
- my_atomic_rwlock_wrlock(&LOCK_tdc_atomics);
need_purge= my_atomic_add32_explicit(&tc_count, 1, MY_MEMORY_ORDER_RELAXED) >=
(int32) tc_size;
- my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics);
if (need_purge)
{
@@ -435,7 +426,6 @@ void tdc_init(void)
tdc_inited= true;
mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares,
MY_MUTEX_INIT_FAST);
- my_atomic_rwlock_init(&LOCK_tdc_atomics);
tdc_version= 1L; /* Increments on each reload */
lf_hash_init(&tdc_hash, sizeof(TDC_element), LF_HASH_UNIQUE, 0, 0,
(my_hash_get_key) TDC_element::key,
@@ -484,7 +474,6 @@ void tdc_deinit(void)
{
tdc_inited= false;
lf_hash_destroy(&tdc_hash);
- my_atomic_rwlock_destroy(&LOCK_tdc_atomics);
mysql_mutex_destroy(&LOCK_unused_shares);
}
DBUG_VOID_RETURN;
@@ -1000,18 +989,13 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
ulong tdc_refresh_version(void)
{
- my_atomic_rwlock_rdlock(&LOCK_tdc_atomics);
- ulong v= my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
- my_atomic_rwlock_rdunlock(&LOCK_tdc_atomics);
- return v;
+ return my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
}
ulong tdc_increment_refresh_version(void)
{
- my_atomic_rwlock_wrlock(&LOCK_tdc_atomics);
ulong v= my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
- my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics);
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", v));
return v + 1;
}
@@ -1154,9 +1138,7 @@ void tdc_assign_new_table_id(TABLE_SHARE *share)
*/
do
{
- my_atomic_rwlock_wrlock(&LOCK_tdc_atomics);
tid= my_atomic_add64_explicit(&last_table_id, 1, MY_MEMORY_ORDER_RELAXED);
- my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics);
} while (unlikely(tid == ~0UL));
share->table_map_id= tid;