summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-29 19:21:53 +0300
committerunknown <monty@mysql.com>2004-03-29 19:21:53 +0300
commitff908d18a27247c3b4206ce49977c4a7c73792be (patch)
treef51ea3945f84d672edc962cdfc11eab16f569fc5 /sql/sql_cache.cc
parent883215956e1597c7432cb79a68b510a4c0f7c9c2 (diff)
parent501c3e7a0e1770aa7b40a2b1c19b8e89388b834f (diff)
downloadmariadb-git-ff908d18a27247c3b4206ce49977c4a7c73792be.tar.gz
Merge with 4.0 to get lastest bug fixes
include/m_string.h: Auto merged myisam/mi_create.c: Auto merged mysql-test/r/bdb-crash.result: Auto merged sql/handler.h: Auto merged mysql-test/r/grant_cache.result: Auto merged mysql-test/t/grant_cache.test: Auto merged sql/sql_cache.cc: Auto merged sql/sql_table.cc: Auto merged innobase/mem/mem0dbg.c: Merge with 4.0 mysql-test/r/myisam.result: Merge with 4.0 mysql-test/r/order_by.result: Merge with 4.0 mysql-test/t/bdb-crash.test: Merge with 4.0 mysql-test/t/myisam.test: Merge with 4.0 mysql-test/t/order_by.test: Merge with 4.0 sql/ha_berkeley.cc: Merge with 4.0 (use local code) sql/sql_select.cc: Merge with 4.0 to get fix for FORCE INDEX ... ORDER BY
Diffstat (limited to 'sql/sql_cache.cc')
-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 40d9b1b42d8..52b0b05a757 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -601,7 +601,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));
@@ -885,7 +884,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;
@@ -1024,7 +1024,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->lex->safe_to_cache_query=0; // Don't try to cache this
BLOCK_UNLOCK_RD(query_block);
@@ -1680,6 +1679,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
{
@@ -1688,6 +1693,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);