summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_preload.c
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-03-23 11:52:45 +0100
committerunknown <istruewing@chilla.local>2007-03-23 11:52:45 +0100
commit4e61fe0c1fcc9a1edc9f3e924594754e10f70ae0 (patch)
treeb9d173076a0b107f820f6bca062bbbe80f7e3c05 /storage/myisam/mi_preload.c
parent206b99e77810dfe8aea5813bbab293bed1c8ecd0 (diff)
downloadmariadb-git-4e61fe0c1fcc9a1edc9f3e924594754e10f70ae0.tar.gz
Bug#17332 - changing key_buffer_size on a running server
can crash under load After review fixes
Diffstat (limited to 'storage/myisam/mi_preload.c')
-rw-r--r--storage/myisam/mi_preload.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index fd6e99c6bc3..06c66c06bf4 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -55,42 +55,20 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
block_length= keyinfo[0].block_length;
- /* Check whether all indexes use the same block size */
- for (i= 1 ; i < keys ; i++)
+ if (ignore_leaves)
{
-#if !defined(INGO_TEST_LOADIDX_OFF)
- /* Allow non-IGNORE-LEAVES index loading even with different block sizes. */
- if (ignore_leaves && (keyinfo[i].block_length != block_length))
- DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
- set_if_bigger(block_length, keyinfo[i].block_length);
-#else
- if (keyinfo[i].block_length != block_length)
- DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
-#endif
- }
-
-#if !defined(INGO_TEST_LOADIDX_OFF)
- /* Align non-IGNORE-LEAVES index loads. */
- if (!ignore_leaves)
- {
- /* Round up to the next multiple of key_cache_block_size. */
- length= ((info->preload_buff_size +
- share->key_cache->key_cache_block_size - 1) /
- share->key_cache->key_cache_block_size *
- share->key_cache->key_cache_block_size);
- /* Round down to the next multiple of key_cache_block_size. */
- pos= (share->base.keystart / share->key_cache->key_cache_block_size *
- share->key_cache->key_cache_block_size);
+ /* Check whether all indexes use the same block size */
+ for (i= 1 ; i < keys ; i++)
+ {
+ if (keyinfo[i].block_length != block_length)
+ DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
+ }
}
else
- {
- length= info->preload_buff_size/block_length * block_length;
- set_if_bigger(length, block_length);
- }
-#else
+ block_length= share->key_cache->key_cache_block_size;
+
length= info->preload_buff_size/block_length * block_length;
set_if_bigger(length, block_length);
-#endif
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);