summaryrefslogtreecommitdiff
path: root/sql/table_cache.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-09-16 18:35:56 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-09-16 18:41:21 +0400
commita2b1c58c19f44ddaac3ec4d4714ffb0b2bec5f35 (patch)
treed306d586f785a3224f64880277377d1a4aa49ba5 /sql/table_cache.cc
parent8613633f2648637f916b949a25d36cfea4120758 (diff)
downloadmariadb-git-a2b1c58c19f44ddaac3ec4d4714ffb0b2bec5f35.tar.gz
MDEV-10296 - Multi-instance table cache
Fixed sysvars_server_[not]embedded failure: changed type of table_open_cache_instances from ulong to uint. Added casts foratomic operations around tc_active_instances and tc_contention_warning_reported: needed on some platforms.
Diffstat (limited to 'sql/table_cache.cc')
-rw-r--r--sql/table_cache.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 26a4ad8f904..5aa5b8c8c82 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -55,7 +55,7 @@
/** Configuration. */
ulong tdc_size; /**< Table definition cache threshold for LRU eviction. */
ulong tc_size; /**< Table cache threshold for LRU eviction. */
-ulong tc_instances;
+uint32 tc_instances;
static uint32 tc_active_instances= 1;
static uint32 tc_contention_warning_reported;
@@ -172,8 +172,9 @@ struct Table_cache_instance
{
if (n_instances < tc_instances)
{
- if (my_atomic_cas32_weak_explicit(&tc_active_instances, &n_instances,
- n_instances + 1,
+ if (my_atomic_cas32_weak_explicit((int32*) &tc_active_instances,
+ (int32*) &n_instances,
+ (int32) n_instances + 1,
MY_MEMORY_ORDER_RELAXED,
MY_MEMORY_ORDER_RELAXED))
{
@@ -186,8 +187,8 @@ struct Table_cache_instance
n_instances + 1);
}
}
- else if (!my_atomic_fas32_explicit(&tc_contention_warning_reported, 1,
- MY_MEMORY_ORDER_RELAXED))
+ else if (!my_atomic_fas32_explicit((int32) &tc_contention_warning_reported,
+ 1, MY_MEMORY_ORDER_RELAXED))
{
sql_print_warning("Detected table cache mutex contention at instance %d: "
"%d%% waits. Additional table cache instance "
@@ -353,7 +354,8 @@ void tc_purge(bool mark_flushed)
void tc_add_table(THD *thd, TABLE *table)
{
- uint32 i= thd->thread_id % my_atomic_load32_explicit(&tc_active_instances, MY_MEMORY_ORDER_RELAXED);
+ uint32 i= thd->thread_id % my_atomic_load32_explicit((int32*) &tc_active_instances,
+ MY_MEMORY_ORDER_RELAXED);
TABLE *LRU_table= 0;
TDC_element *element= table->s->tdc;
@@ -395,7 +397,8 @@ void tc_add_table(THD *thd, TABLE *table)
static TABLE *tc_acquire_table(THD *thd, TDC_element *element)
{
uint32 n_instances=
- my_atomic_load32_explicit(&tc_active_instances, MY_MEMORY_ORDER_RELAXED);
+ my_atomic_load32_explicit((int32*) &tc_active_instances,
+ MY_MEMORY_ORDER_RELAXED);
uint32 i= thd->thread_id % n_instances;
TABLE *table;