Fix of debbuging mode of query cache (proposed by Monty reviewed by me).

parent 2b9bcb2c
...@@ -702,6 +702,7 @@ void query_cache_abort(NET *net) ...@@ -702,6 +702,7 @@ void query_cache_abort(NET *net)
void query_cache_end_of_result(THD *thd) void query_cache_end_of_result(THD *thd)
{ {
Query_cache_block *query_block;
DBUG_ENTER("query_cache_end_of_result"); DBUG_ENTER("query_cache_end_of_result");
/* See the comment on double-check locking usage above. */ /* See the comment on double-check locking usage above. */
...@@ -717,13 +718,9 @@ void query_cache_end_of_result(THD *thd) ...@@ -717,13 +718,9 @@ void query_cache_end_of_result(THD *thd)
if (unlikely(query_cache.query_cache_size == 0 || if (unlikely(query_cache.query_cache_size == 0 ||
query_cache.flush_in_progress)) query_cache.flush_in_progress))
{ goto end;
STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
DBUG_VOID_RETURN;
}
Query_cache_block *query_block= ((Query_cache_block*) query_block= ((Query_cache_block*) thd->net.query_cache_query);
thd->net.query_cache_query);
if (query_block) if (query_block)
{ {
DUMP(&query_cache); DUMP(&query_cache);
...@@ -742,27 +739,25 @@ void query_cache_end_of_result(THD *thd) ...@@ -742,27 +739,25 @@ void query_cache_end_of_result(THD *thd)
header->query())); header->query()));
query_cache.wreck(__LINE__, ""); query_cache.wreck(__LINE__, "");
STRUCT_UNLOCK(&query_cache.structure_guard_mutex); /*
We do not need call of BLOCK_UNLOCK_WR(query_block); here because
DBUG_VOID_RETURN; query_cache.wreck() switched query cache off but left content
untouched for investigation (it is debugging method).
*/
goto end;
} }
#endif #endif
header->found_rows(current_thd->limit_found_rows); header->found_rows(current_thd->limit_found_rows);
header->result()->type= Query_cache_block::RESULT; header->result()->type= Query_cache_block::RESULT;
header->writer(0); header->writer(0);
thd->net.query_cache_query= 0; thd->net.query_cache_query= 0;
BLOCK_UNLOCK_WR(query_block);
DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1);); DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1););
STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
BLOCK_UNLOCK_WR(query_block);
}
else
{
// Cache was flushed or resized and query was deleted => do nothing
STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
} }
end:
STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -3529,7 +3524,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path, ...@@ -3529,7 +3524,7 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
#if defined(DBUG_OFF) && !defined(USE_QUERY_CACHE_INTEGRITY_CHECK) #if defined(DBUG_OFF) && !defined(USE_QUERY_CACHE_INTEGRITY_CHECK)
void wreck(uint line, const char *message) {} void wreck(uint line, const char *message) { query_cache_size = 0; }
void bins_dump() {} void bins_dump() {}
void cache_dump() {} void cache_dump() {}
void queries_dump() {} void queries_dump() {}
...@@ -3541,6 +3536,17 @@ my_bool in_blocks(Query_cache_block * point) { return 0; } ...@@ -3541,6 +3536,17 @@ my_bool in_blocks(Query_cache_block * point) { return 0; }
#else #else
/*
Debug method which switch query cache off but left content for
investigation.
SYNOPSIS
Query_cache::wreck()
line line of the wreck() call
message message for logging
*/
void Query_cache::wreck(uint line, const char *message) void Query_cache::wreck(uint line, const char *message)
{ {
THD *thd=current_thd; THD *thd=current_thd;
......
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