diff options
Diffstat (limited to 'storage')
-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 397856a4a4e..9f9fce98b43 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -858,6 +858,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"); @@ -889,7 +890,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); |