Skip to content

Commit 0077d9c

Browse files
committed
Bug#18487951 - QUERY_CACHE_MIN_RES_UNIT SET TO ZERO, CRASHES IN QUERY_CACHE::FIND_BIN
Merge branch 'mysql-5.5' into mysql-5.6
2 parents 90035bd + 7ce304d commit 0077d9c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sql/sql_cache.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2013, 2015, Oracle and/or its affiliates. All rights
2+
reserved.
23
34
This program is free software; you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
@@ -404,6 +405,9 @@ using std::max;
404405
#define QC_DEBUG_SYNC(name)
405406
#endif
406407

408+
// Max aligned size for ulong type query_cache_min_res_unit.
409+
static const ulong max_aligned_min_res_unit_size= ((ULONG_MAX) &
410+
(~(sizeof(double) - 1)));
407411

408412
/**
409413
Thread state to be used when the query cache lock needs to be acquired.
@@ -1168,6 +1172,9 @@ ulong Query_cache::set_min_res_unit(ulong size)
11681172
{
11691173
if (size < min_allocation_unit)
11701174
size= min_allocation_unit;
1175+
else if (size > max_aligned_min_res_unit_size)
1176+
size= max_aligned_min_res_unit_size;
1177+
11711178
return (min_result_data_size= ALIGN_SIZE(size));
11721179
}
11731180

0 commit comments

Comments
 (0)