summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorPeter Shchuchkin <peters@yandex.ru>2017-08-25 12:43:28 +0300
committerSergey Vojtovich <svoj@mariadb.org>2017-08-31 13:50:25 +0400
commitcf3a74eb60410e092c3098e77d818b7953c41d16 (patch)
treee33daf240ebbe6da027e01eb7ee8118177c9b707 /sql/sql_cache.cc
parent5dd8e1bf2d15a68359e37b439a0d5999808b8001 (diff)
downloadmariadb-git-cf3a74eb60410e092c3098e77d818b7953c41d16.tar.gz
Counting hits for queries in query cache.
Added hit_count field to Query_cache_query and methods to get and increment it. The counter is incremented when query results are read from query cache.
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index cc2edfed123..ed5a8f84127 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -961,7 +961,7 @@ inline void Query_cache_query::unlock_reading()
void Query_cache_query::init_n_lock()
{
DBUG_ENTER("Query_cache_query::init_n_lock");
- res=0; wri = 0; len = 0; ready= 0;
+ res=0; wri = 0; len = 0; ready= 0; hit_count = 0;
mysql_rwlock_init(key_rwlock_query_cache_query_lock, &lock);
lock_writing();
DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx",
@@ -2142,6 +2142,7 @@ lookup:
}
move_to_query_list_end(query_block);
hits++;
+ query->increment_hits();
unlock();
/*