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.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f1803a329c5..e51c53f644e 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -704,6 +704,7 @@ void query_cache_insert(NET *net, const char *packet, ulong length)
void query_cache_abort(NET *net)
{
DBUG_ENTER("query_cache_abort");
+ THD *thd= current_thd;
/* See the comment on double-check locking usage above. */
if (net->query_cache_query == 0)
@@ -726,6 +727,7 @@ void query_cache_abort(NET *net)
net->query_cache_query);
if (query_block)
{
+ thd_proc_info(thd, "storing result in query cache");
DUMP(&query_cache);
BLOCK_LOCK_WR(query_block);
// The following call will remove the lock on query_block
@@ -778,6 +780,7 @@ void query_cache_end_of_result(THD *thd)
suitable size if needed and setting block type. Since this is the last
block, the writer should be dropped.
*/
+ thd_proc_info(thd, "storing result in query cache");
DUMP(&query_cache);
BLOCK_LOCK_WR(query_block);
Query_cache_query *header= query_block->query();
@@ -1201,6 +1204,8 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT("qcache", ("No active database"));
}
+ thd_proc_info(thd, "checking query cache for query");
+
// fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG);
@@ -1283,6 +1288,7 @@ def_week_frmt: %lu",
}
// Check access;
+ thd_proc_info(thd, "checking privileges on cached query");
block_table= query_block->table(0);
block_table_end= block_table+query_block->n_tables;
for (; block_table != block_table_end; block_table++)
@@ -1377,6 +1383,7 @@ def_week_frmt: %lu",
Send cached result to client
*/
#ifndef EMBEDDED_LIBRARY
+ thd_proc_info(thd, "sending cached result to client");
do
{
DBUG_PRINT("qcache", ("Results (len: %lu used: %lu headers: %lu)",
@@ -1453,6 +1460,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
THD *thd= current_thd;
for (; tables_used; tables_used= tables_used->next)
{
+ thd_proc_info(thd, "invalidating query cache entries (table list)");
invalidate_table(thd, (uchar*) tables_used->key, tables_used->key_length);
DBUG_PRINT("qcache", ("db: %s table: %s", tables_used->key,
tables_used->key+
@@ -1474,9 +1482,11 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
*/
void Query_cache::invalidate_locked_for_write(TABLE_LIST *tables_used)
{
+ THD *thd= current_thd;
DBUG_ENTER("Query_cache::invalidate_locked_for_write");
for (; tables_used; tables_used= tables_used->next_local)
{
+ thd_proc_info(thd, "invalidating query cache entries (table)");
if (tables_used->lock_type & (TL_WRITE_LOW_PRIORITY | TL_WRITE) &&
tables_used->table)
{
@@ -1525,7 +1535,7 @@ void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
/**
- @brief Synchronize the thread with any flushing operations.
+ Synchronize the thread with any flushing operations.
This helper function is called whenever a thread needs to operate on the
query cache structure (example: during invalidation). If a table flush is in
@@ -1566,7 +1576,7 @@ void Query_cache::wait_while_table_flush_is_in_progress(bool *interrupt)
/**
- @brief Remove all cached queries that uses the given database
+ Remove all cached queries that uses the given database.
*/
void Query_cache::invalidate(char *db)
@@ -1676,8 +1686,8 @@ void Query_cache::flush()
/**
- @brief Rearrange the memory blocks and join result in cache in 1 block (if
- result length > join_limit)
+ Rearrange the memory blocks and join result in cache in 1 block (if
+ result length > join_limit)
@param[in] join_limit If the minimum length of a result block to be joined.
@param[in] iteration_limit The maximum number of packing and joining
@@ -1947,7 +1957,7 @@ void Query_cache::make_disabled()
/**
@class Query_cache
- @brief Free all resources allocated by the cache.
+ Free all resources allocated by the cache.
This function frees all resources allocated by the cache. You
have to call init_cache() before using the cache again. This function
@@ -1971,7 +1981,7 @@ void Query_cache::free_cache()
/**
- @brief Flush the cache.
+ Flush the cache.
This function will flush cache contents. It assumes we have
'structure_guard_mutex' locked. The function sets the m_cache_status flag and
@@ -2517,7 +2527,7 @@ Query_cache::invalidate_table_internal(THD *thd, uchar *key, uint32 key_length)
}
/**
- @brief Invalidate a linked list of query cache blocks.
+ Invalidate a linked list of query cache blocks.
Each block tries to aquire a block level lock before
free_query is a called. This function will in turn affect
@@ -2685,7 +2695,7 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
/**
- @brief Insert used table name into the cache.
+ Insert used table name into the cache.
@return Error status
@retval FALSE On error
@@ -3414,8 +3424,8 @@ my_bool Query_cache::ask_handler_allowance(THD *thd,
/**
- @brief Rearrange all memory blocks so that free memory joins at the
- 'bottom' of the allocated memory block containing all cache data.
+ Rearrange all memory blocks so that free memory joins at the
+ 'bottom' of the allocated memory block containing all cache data.
@see Query_cache::pack(ulong join_limit, uint iteration_limit)
*/
@@ -4029,7 +4039,7 @@ void Query_cache::tables_dump()
/**
- @brief Checks integrity of the various linked lists
+ Checks integrity of the various linked lists
@return Error status code
@retval FALSE Query cache is operational.