diff options
author | unknown <istruewing@chilla.local> | 2007-03-20 17:59:09 +0100 |
---|---|---|
committer | unknown <istruewing@chilla.local> | 2007-03-20 17:59:09 +0100 |
commit | 206b99e77810dfe8aea5813bbab293bed1c8ecd0 (patch) | |
tree | 4cde4ad1f259a472f11c1611800716539c7206bf /storage/myisam | |
parent | e3108256e7e5118cd2097f2bfbc9987018a6b8a5 (diff) | |
parent | 3514500e8d46ce566e80a3b052f47ab393187cc3 (diff) | |
download | mariadb-git-206b99e77810dfe8aea5813bbab293bed1c8ecd0.tar.gz |
Merge chilla.local:/home/mydev/mysql-5.1-bug17332-old
into chilla.local:/home/mydev/mysql-5.1-bug17332
sql/handler.cc:
Auto merged
sql/sql_table.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
mysys/mf_keycache.c:
Bug#17332 - changing key_buffer_size on a running server
can crash under load
Manual merge
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 2 | ||||
-rw-r--r-- | storage/myisam/mi_preload.c | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 26a880bc704..77e2c01cb39 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1227,6 +1227,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) ulonglong map= ~(ulonglong) 0; TABLE_LIST *table_list= table->pos_in_table_list; my_bool ignore_leaves= table_list->ignore_leaves; + char buf[ERRMSGSIZE+20]; DBUG_ENTER("ha_myisam::preload_keys"); @@ -1258,7 +1259,6 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) errmsg= "Failed to allocate buffer"; break; default: - char buf[ERRMSGSIZE+20]; my_snprintf(buf, ERRMSGSIZE, "Failed to read from index file (errno: %d)", my_errno); errmsg= buf; diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c index 78729f18424..fd6e99c6bc3 100644 --- a/storage/myisam/mi_preload.c +++ b/storage/myisam/mi_preload.c @@ -58,12 +58,39 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves) /* Check whether all indexes use the same block size */ for (i= 1 ; i < keys ; i++) { +#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); + } + else + { + length= info->preload_buff_size/block_length * block_length; + set_if_bigger(length, block_length); + } +#else 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); |