summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc21
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f862cbed4f1..8114e0221d6 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -333,6 +333,7 @@ TODO list:
#include <hash.h>
#include "../storage/myisammrg/ha_myisammrg.h"
#include "../storage/myisammrg/myrg_def.h"
+#include "probes_mysql.h"
#ifdef EMBEDDED_LIBRARY
#include "emb_qcache.h"
@@ -1334,14 +1335,18 @@ end:
Check if the query is in the cache. If it was cached, send it
to the user.
- RESULTS
- 1 Query was not cached.
- 0 The query was cached and user was sent the result.
- -1 The query was cached but we didn't have rights to use it.
- No error is sent to the client yet.
+ @param thd Pointer to the thread handler
+ @param sql A pointer to the sql statement *
+ @param query_length Length of the statement in characters
+
+ @return status code
+ @retval 1 Query was not cached.
+ @retval 0 The query was cached and user was sent the result.
+ @retval -1 The query was cached but we didn't have rights to use it.
+
+ In case of -1, no error is sent to the client.
- NOTE
- This method requires that sql points to allocated memory of size:
+ *) The buffer must be allocated memory of size:
tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE;
*/
@@ -1656,11 +1661,13 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
thd->main_da.disable_status();
BLOCK_UNLOCK_RD(query_block);
+ MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
DBUG_RETURN(1); // Result sent to client
err_unlock:
unlock();
err:
+ MYSQL_QUERY_CACHE_MISS(thd->query());
DBUG_RETURN(0); // Query was not cached
}