Commit 6816c80c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-11435 - fix integer divided by zero exception when calculating

buffer pool size

The reason for the exception is previous overflow in multiplication of
two 32bit integers (product was 0 rather than expected 8GB, due
to truncation)
parent 7f6710e5
...@@ -1451,13 +1451,13 @@ ulint ...@@ -1451,13 +1451,13 @@ ulint
buf_pool_size_align( buf_pool_size_align(
ulint size) ulint size)
{ {
const ulint m = srv_buf_pool_instances * srv_buf_pool_chunk_unit; const ib_uint64_t m = ((ib_uint64_t)srv_buf_pool_instances) * srv_buf_pool_chunk_unit;
size = ut_max(size, srv_buf_pool_min_size); size = ut_max(size, srv_buf_pool_min_size);
if (size % m == 0) { if (size % m == 0) {
return(size); return(size);
} else { } else {
return((size / m + 1) * m); return (ulint)((size / m + 1) * m);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment