summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-06-07 00:02:50 +0300
committerunknown <bell@sanja.is.com.ua>2002-06-07 00:02:50 +0300
commitfb104d76b5a95cb7056288f4840776cfd5ee7899 (patch)
tree45790d70cb4b45ac72379245ba4666a770244201 /sql/sql_cache.cc
parentef99fb2e8be48b7bf148980490c3a01f406cf624 (diff)
downloadmariadb-git-fb104d76b5a95cb7056288f4840776cfd5ee7899.tar.gz
Fixed query cache align data bug.
Docs/manual.texi: change log modification
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 4a2900bf0a0..b8dfda076c5 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2679,14 +2679,17 @@ my_bool Query_cache::move_by_type(byte **border,
*border += len;
*before = new_block;
/* If result writing complete && we have free space in block */
- ulong free_space = new_block->length - new_block->used;
+ ulong free_space= new_block->length - new_block->used;
+ free_space-= free_space % ALIGN_SIZE(1);
if (query->result()->type == Query_cache_block::RESULT &&
new_block->length > new_block->used &&
*gap + free_space > min_allocation_unit &&
new_block->length - free_space > min_allocation_unit)
{
- *border -= free_space;
- *gap += free_space;
+ *border-= free_space;
+ *gap+= free_space;
+ DBUG_PRINT("qcache",
+ ("rest of result free space added to gap (%lu)", *gap));
new_block->length -= free_space;
}
BLOCK_UNLOCK_WR(query_block);
@@ -2747,7 +2750,7 @@ my_bool Query_cache::join_results(ulong join_limit)
header->length() > join_limit)
{
Query_cache_block *new_result_block =
- get_free_block(header->length() +
+ get_free_block(ALIGN_SIZE(header->length()) +
ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result)), 1, 0);
if (new_result_block != 0)