summaryrefslogtreecommitdiff
path: root/sql/sql_expression_cache.cc
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2011-08-12 11:23:50 +0300
committerunknown <sanja@askmonty.org>2011-08-12 11:23:50 +0300
commit78eacb556daaa2e1e89ef46e17d9f128e139d10f (patch)
tree1fb12dccca0abed2769b8a8581fac250b271f470 /sql/sql_expression_cache.cc
parent07e9d34c5478ac18d77689e99f461e1a9f8a873a (diff)
downloadmariadb-git-78eacb556daaa2e1e89ef46e17d9f128e139d10f.tar.gz
Protect statistic variables of subquery cache.
Diffstat (limited to 'sql/sql_expression_cache.cc')
-rw-r--r--sql/sql_expression_cache.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc
index bb39df45e25..e88b136a684 100644
--- a/sql/sql_expression_cache.cc
+++ b/sql/sql_expression_cache.cc
@@ -157,6 +157,10 @@ error:
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)
free_tmp_table(table_thd, cache_table);
}
@@ -188,14 +192,13 @@ Expression_cache::result Expression_cache_tmptable::check_value(Item **value)
(uint)cache_table->status, (uint)ref.has_record));
if ((res= join_read_key2(table_thd, NULL, cache_table, &ref)) == 1)
DBUG_RETURN(ERROR);
+
if (res)
{
- subquery_cache_miss++;
miss++;
DBUG_RETURN(MISS);
}
- subquery_cache_hit++;
hit++;
*value= cached_result;
DBUG_RETURN(Expression_cache::HIT);