diff options
author | gshchepa@bk-internal.mysql.com <> | 2007-08-23 21:38:24 +0200 |
---|---|---|
committer | gshchepa@bk-internal.mysql.com <> | 2007-08-23 21:38:24 +0200 |
commit | 46e58466cb7db043a5fb7fcd4abc79db14f16e8d (patch) | |
tree | a0b303e785424c3fcef2d119a9160f0c463fb6b2 /sql/sql_cache.cc | |
parent | 400aec95f7dcf0a25b41c90854584f47cce12b35 (diff) | |
parent | 1e7fe52dbbca6b98fb590ebde6dee2cc1c97f462 (diff) | |
download | mariadb-git-46e58466cb7db043a5fb7fcd4abc79db14f16e8d.tar.gz |
Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into bk-internal.mysql.com:/users/gshchepa/mysql-5.1-opt
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 98d99f4c6e2..ada927fa467 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -749,6 +749,12 @@ void query_cache_end_of_result(THD *thd) if (thd->net.query_cache_query == 0) DBUG_VOID_RETURN; + if (thd->killed) + { + query_cache_abort(&thd->net); + DBUG_VOID_RETURN; + } + #ifdef EMBEDDED_LIBRARY query_cache_insert(&thd->net, (char*)thd, emb_count_querycache_size(thd)); @@ -775,28 +781,31 @@ void query_cache_end_of_result(THD *thd) DUMP(&query_cache); BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); - Query_cache_block *last_result_block= header->result()->prev; - ulong allign_size= ALIGN_SIZE(last_result_block->used); - ulong len= max(query_cache.min_allocation_unit, allign_size); - if (last_result_block->length >= query_cache.min_allocation_unit + len) - query_cache.split_block(last_result_block,len); + Query_cache_block *last_result_block; + ulong allign_size; + ulong len; -#ifndef DBUG_OFF if (header->result() == 0) { - DBUG_PRINT("error", ("end of data whith no result. query '%s'", - header->query())); - query_cache.wreck(__LINE__, ""); - + DBUG_PRINT("error", ("End of data with no result blocks; " + "Query '%s' removed from cache.", header->query())); /* - 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). + Extra safety: empty result should not happen in the normal call + to this function. In the release version that query should be ignored + and removed from QC. */ + DBUG_ASSERT(0); + query_cache.free_query(query_block); STRUCT_UNLOCK(&query_cache.structure_guard_mutex); DBUG_VOID_RETURN; } -#endif + + last_result_block= header->result()->prev; + allign_size= ALIGN_SIZE(last_result_block->used); + len= max(query_cache.min_allocation_unit, allign_size); + if (last_result_block->length >= query_cache.min_allocation_unit + len) + query_cache.split_block(last_result_block,len); + header->found_rows(current_thd->limit_found_rows); header->result()->type= Query_cache_block::RESULT; |