diff options
author | monty@mysql.com <> | 2004-03-29 19:21:53 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-03-29 19:21:53 +0300 |
commit | dc2f606fb85e0763a448132a147a816de829a8cb (patch) | |
tree | f51ea3945f84d672edc962cdfc11eab16f569fc5 /sql/sql_cache.cc | |
parent | 505970b4a76f3d41f338d32d3d4382891ecb0ec3 (diff) | |
parent | 3cbab63af1e92677217be8106d5ed696b20521b1 (diff) | |
download | mariadb-git-dc2f606fb85e0763a448132a147a816de829a8cb.tar.gz |
Merge with 4.0 to get lastest bug fixes
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 17 |
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); |