summaryrefslogtreecommitdiff
path: root/mysys/mf_keycache.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-08-13 01:27:23 +0300
committerMonty <monty@mariadb.org>2015-08-13 01:27:23 +0300
commitafa9cb7519fcb73d546bba45d3baa7b157926084 (patch)
treee207ab7924f79ce56c822cf2f6b76f2ff9fe925a /mysys/mf_keycache.c
parent0403790722e3941779ccea26e85fcd818e2320b5 (diff)
downloadmariadb-git-afa9cb7519fcb73d546bba45d3baa7b157926084.tar.gz
Fixed overrun in key cache if one tried to allocate a key cache
of more than 45G with a key_cache_block_size of 1024 or less. The problem was that some of the arguments to my_multi_malloc() got to be more than 4G. Fix: - Inntroduced my_multi_malloc_large() that can handle big regions. - Changed MyISAM and Aria key caches to use my_multi_malloc_large(). I didn't change the default my_multi_malloc() as this would be a too big patch and we don't allocate 4G blocks anywhere else.
Diffstat (limited to 'mysys/mf_keycache.c')
-rw-r--r--mysys/mf_keycache.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 0faba93c0a3..16ac749fa09 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -552,17 +552,21 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache,
Allocate memory for blocks, hash_links and hash entries;
For each block 2 hash links are allocated
*/
- if (my_multi_malloc(MYF(MY_ZEROFILL),
- &keycache->block_root, blocks * sizeof(BLOCK_LINK),
- &keycache->hash_root,
- sizeof(HASH_LINK*) * keycache->hash_entries,
- &keycache->hash_link_root,
- hash_links * sizeof(HASH_LINK),
- &keycache->changed_blocks,
- sizeof(BLOCK_LINK*) * changed_blocks_hash_size,
- &keycache->file_blocks,
- sizeof(BLOCK_LINK*) * changed_blocks_hash_size,
- NullS))
+ if (my_multi_malloc_large(MYF(MY_ZEROFILL),
+ &keycache->block_root,
+ (ulonglong) (blocks * sizeof(BLOCK_LINK)),
+ &keycache->hash_root,
+ (ulonglong) (sizeof(HASH_LINK*) *
+ keycache->hash_entries),
+ &keycache->hash_link_root,
+ (ulonglong) (hash_links * sizeof(HASH_LINK)),
+ &keycache->changed_blocks,
+ (ulonglong) (sizeof(BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ &keycache->file_blocks,
+ (ulonglong) (sizeof(BLOCK_LINK*) *
+ changed_blocks_hash_size),
+ NullS))
break;
my_large_free(keycache->block_mem);
keycache->block_mem= 0;