summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-03-21 11:48:51 +0200
committerunknown <bell@sanja.is.com.ua>2004-03-21 11:48:51 +0200
commit547fe1bffec9d4ff2f3de079b1d946d208813b13 (patch)
treea1329b674e130295016f32bff9fcb79e31b36985 /sql
parent262d5311d4563ab07835fc0d2518ca14ee69fb43 (diff)
downloadmariadb-git-547fe1bffec9d4ff2f3de079b1d946d208813b13.tar.gz
fixed BUG in query cahe statistic counting
mysql-test/r/grant_cache.result: right results in query cache mysql-test/t/grant_cache.test: proving new results sql/sql_cache.cc: fixed statistic calculating in query cahe
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cache.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 77bdcb79a8d..5118421464b 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -589,7 +589,6 @@ void query_cache_insert(NET *net, const char *packet, ulong length)
if (!query_cache.append_result_data(&result, length, (gptr) packet,
query_block))
{
- query_cache.refused++;
DBUG_PRINT("warning", ("Can't append data"));
header->result(result);
DBUG_PRINT("qcache", ("free query 0x%lx", (ulong) query_block));
@@ -845,7 +844,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
}
}
else
- statistic_increment(refused, &structure_guard_mutex);
+ if (thd->lex.sql_command == SQLCOM_SELECT)
+ statistic_increment(refused, &structure_guard_mutex);
end:
DBUG_VOID_RETURN;
@@ -981,7 +981,6 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT("qcache",
("probably no SELECT access to %s.%s => return to normal processing",
table_list.db, table_list.alias));
- refused++; // This is actually a hit
STRUCT_UNLOCK(&structure_guard_mutex);
thd->safe_to_cache_query=0; // Don't try to cache this
BLOCK_UNLOCK_RD(query_block);
@@ -1610,6 +1609,12 @@ void Query_cache::free_query(Query_cache_block *query_block)
*/
if (result_block != 0)
{
+ if (result_block->type != Query_cache_block::RESULT)
+ {
+ // removing unfinished query
+ refused++;
+ inserts--;
+ }
Query_cache_block *block = result_block;
do
{
@@ -1618,6 +1623,12 @@ void Query_cache::free_query(Query_cache_block *query_block)
free_memory_block(current);
} while (block != result_block);
}
+ else
+ {
+ // removing unfinished query
+ refused++;
+ inserts--;
+ }
query->unlock_n_destroy();
free_memory_block(query_block);