1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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
This commit is contained in:
unknown
2004-03-21 11:48:51 +02:00
parent 331ff0d8f5
commit 91bac76e03
3 changed files with 65 additions and 6 deletions

View File

@ -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);