Commit 9749447c authored by unknown's avatar unknown

Protect statistic variables of subquery cache.

parent d3255114
...@@ -157,6 +157,10 @@ void Expression_cache_tmptable::init() ...@@ -157,6 +157,10 @@ void Expression_cache_tmptable::init()
Expression_cache_tmptable::~Expression_cache_tmptable() Expression_cache_tmptable::~Expression_cache_tmptable()
{ {
/* Add accumulated statistics */
statistic_add(subquery_cache_miss, miss, &LOCK_status);
statistic_add(subquery_cache_hit, hit, &LOCK_status);
if (cache_table) if (cache_table)
free_tmp_table(table_thd, cache_table); free_tmp_table(table_thd, cache_table);
} }
...@@ -188,14 +192,13 @@ Expression_cache::result Expression_cache_tmptable::check_value(Item **value) ...@@ -188,14 +192,13 @@ Expression_cache::result Expression_cache_tmptable::check_value(Item **value)
(uint)cache_table->status, (uint)ref.has_record)); (uint)cache_table->status, (uint)ref.has_record));
if ((res= join_read_key2(table_thd, NULL, cache_table, &ref)) == 1) if ((res= join_read_key2(table_thd, NULL, cache_table, &ref)) == 1)
DBUG_RETURN(ERROR); DBUG_RETURN(ERROR);
if (res) if (res)
{ {
subquery_cache_miss++;
miss++; miss++;
DBUG_RETURN(MISS); DBUG_RETURN(MISS);
} }
subquery_cache_hit++;
hit++; hit++;
*value= cached_result; *value= cached_result;
DBUG_RETURN(Expression_cache::HIT); DBUG_RETURN(Expression_cache::HIT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment