diff options
author | monty@mysql.com/nosik.monty.fi <> | 2007-07-25 01:58:12 +0300 |
---|---|---|
committer | monty@mysql.com/nosik.monty.fi <> | 2007-07-25 01:58:12 +0300 |
commit | dd81895e4544a9b33beb73370781b35c0bf934de (patch) | |
tree | c1182b5c000610131fdb634bd8c0075eab705f6d /mysys/mf_keycache.c | |
parent | c6653675c8520b2eaf9d6df60c43d6d6e8fbe443 (diff) | |
download | mariadb-git-dd81895e4544a9b33beb73370781b35c0bf934de.tar.gz |
Added support for 'internal temporary tables' in HEAP tables.
Now we don't take any mutexes when creating or dropping internal HEAP tables during SELECT.
Change buffer sizes to size_t to make keycache 64 bit safe on platforms where sizeof(ulong) != sizeof(size_t)
Diffstat (limited to 'mysys/mf_keycache.c')
-rw-r--r-- | mysys/mf_keycache.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 1fef8aac170..c81da9a469a 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -366,10 +366,11 @@ static inline uint next_power(uint value) */ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, - ulong use_mem, uint division_limit, + size_t use_mem, uint division_limit, uint age_threshold) { - uint blocks, hash_links, length; + ulong blocks, hash_links; + size_t length; int error; DBUG_ENTER("init_key_cache"); DBUG_ASSERT(key_cache_block_size >= 512); @@ -405,8 +406,8 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, DBUG_PRINT("info", ("key_cache_block_size: %u", key_cache_block_size)); - blocks= (uint) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) + - sizeof(HASH_LINK*) * 5/4 + key_cache_block_size)); + blocks= (ulong) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) + + sizeof(HASH_LINK*) * 5/4 + key_cache_block_size)); /* It doesn't make sense to have too few blocks (less than 8) */ if (blocks >= 8) { @@ -424,18 +425,18 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, ALIGN_SIZE(hash_links * sizeof(HASH_LINK)) + ALIGN_SIZE(sizeof(HASH_LINK*) * keycache->hash_entries))) + - ((ulong) blocks * keycache->key_cache_block_size) > use_mem) + ((size_t) blocks * keycache->key_cache_block_size) > use_mem) blocks--; /* Allocate memory for cache page buffers */ if ((keycache->block_mem= - my_large_malloc((ulong) blocks * keycache->key_cache_block_size, + my_large_malloc((size_t) blocks * keycache->key_cache_block_size, MYF(MY_WME)))) { /* Allocate memory for blocks, hash_links and hash entries; For each block 2 hash links are allocated */ - if ((keycache->block_root= (BLOCK_LINK*) my_malloc((uint) length, + if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length, MYF(0)))) break; my_large_free(keycache->block_mem, MYF(0)); @@ -448,7 +449,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, } blocks= blocks / 4*3; } - keycache->blocks_unused= (ulong) blocks; + keycache->blocks_unused= blocks; keycache->disk_blocks= (int) blocks; keycache->hash_links= hash_links; keycache->hash_root= (HASH_LINK**) ((char*) keycache->block_root + @@ -556,7 +557,7 @@ err: */ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, - ulong use_mem, uint division_limit, + size_t use_mem, uint division_limit, uint age_threshold) { int blocks; |