summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@desktop.sanja.is.com.ua>2006-11-17 08:18:10 +0200
committerunknown <bell@desktop.sanja.is.com.ua>2006-11-17 08:18:10 +0200
commit779f9feda89f363a5b7a8baf4ecaaf57c5a4b75b (patch)
treef14bdc955eeea94e522e8a5eb5ffd5f9d89403b4
parenta4823607f9084153c405eaef753a35de6156a31b (diff)
downloadmariadb-git-779f9feda89f363a5b7a8baf4ecaaf57c5a4b75b.tar.gz
Fix of debbuging mode of query cache (proposed by Monty reviewed by me).
sql/sql_cache.cc: Call of BLOCK_UNLOCK_WR() moved before query_cache.check_integrity() call which privent lock of query cache during debugging. Comments added.
-rw-r--r--sql/sql_cache.cc42
1 files changed, 24 insertions, 18 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index ff033b69f98..1d8c79d0a1a 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -702,6 +702,7 @@ void query_cache_abort(NET *net)
void query_cache_end_of_result(THD *thd)
{
+ Query_cache_block *query_block;
DBUG_ENTER("query_cache_end_of_result");
/* See the comment on double-check locking usage above. */
@@ -717,13 +718,9 @@ void query_cache_end_of_result(THD *thd)
if (unlikely(query_cache.query_cache_size == 0 ||
query_cache.flush_in_progress))
- {
- STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
- DBUG_VOID_RETURN;
- }
+ goto end;
- Query_cache_block *query_block= ((Query_cache_block*)
- thd->net.query_cache_query);
+ query_block= ((Query_cache_block*) thd->net.query_cache_query);
if (query_block)
{
DUMP(&query_cache);
@@ -742,27 +739,25 @@ void query_cache_end_of_result(THD *thd)
header->query()));
query_cache.wreck(__LINE__, "");
- STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
-
- DBUG_VOID_RETURN;
+ /*
+ We do not need call of BLOCK_UNLOCK_WR(query_block); here because
+ query_cache.wreck() switched query cache off but left content
+ untouched for investigation (it is debugging method).
+ */
+ goto end;
}
#endif
header->found_rows(current_thd->limit_found_rows);
header->result()->type= Query_cache_block::RESULT;
header->writer(0);
thd->net.query_cache_query= 0;
+ BLOCK_UNLOCK_WR(query_block);
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;
}
@@ -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)
-void wreck(uint line, const char *message) {}
+void wreck(uint line, const char *message) { query_cache_size = 0; }
void bins_dump() {}
void cache_dump() {}
void queries_dump() {}
@@ -3541,6 +3536,17 @@ my_bool in_blocks(Query_cache_block * point) { return 0; }
#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)
{
THD *thd=current_thd;