mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge chilla.local:/home/mydev/mysql-5.1-bug17332-old
into chilla.local:/home/mydev/mysql-5.1-bug17332
This commit is contained in:
@ -44,6 +44,7 @@ typedef struct st_keycache_wqueue
|
|||||||
typedef struct st_key_cache
|
typedef struct st_key_cache
|
||||||
{
|
{
|
||||||
my_bool key_cache_inited;
|
my_bool key_cache_inited;
|
||||||
|
my_bool in_resize; /* true during resize operation */
|
||||||
my_bool resize_in_flush; /* true during flush of resize operation */
|
my_bool resize_in_flush; /* true during flush of resize operation */
|
||||||
my_bool can_be_used; /* usage of cache for read/write is allowed */
|
my_bool can_be_used; /* usage of cache for read/write is allowed */
|
||||||
uint key_cache_shift;
|
uint key_cache_shift;
|
||||||
@ -72,6 +73,11 @@ typedef struct st_key_cache
|
|||||||
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
|
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
|
||||||
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
|
pthread_mutex_t cache_lock; /* to lock access to the cache structure */
|
||||||
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
|
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
|
||||||
|
/*
|
||||||
|
Waiting for a zero resize count. Using a queue for symmetry though
|
||||||
|
only one thread can wait here.
|
||||||
|
*/
|
||||||
|
KEYCACHE_WQUEUE waiting_for_resize_cnt;
|
||||||
KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */
|
KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */
|
||||||
KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */
|
KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */
|
||||||
BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/
|
BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/
|
||||||
|
2563
mysys/mf_keycache.c
2563
mysys/mf_keycache.c
File diff suppressed because it is too large
Load Diff
@ -48,9 +48,6 @@ struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
|
|||||||
sigset_t my_signals; /* signals blocked by mf_brkhant */
|
sigset_t my_signals; /* signals blocked by mf_brkhant */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* from mf_keycache.c */
|
|
||||||
my_bool key_cache_inited=0;
|
|
||||||
|
|
||||||
/* from mf_reccache.c */
|
/* from mf_reccache.c */
|
||||||
ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
|
ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
|
||||||
|
|
||||||
|
@ -2691,8 +2691,8 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache)
|
|||||||
if (!key_cache->key_cache_inited)
|
if (!key_cache->key_cache_inited)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||||
long tmp_buff_size= (long) key_cache->param_buff_size;
|
ulong tmp_buff_size= (ulong) key_cache->param_buff_size;
|
||||||
long tmp_block_size= (long) key_cache->param_block_size;
|
uint tmp_block_size= (uint) key_cache->param_block_size;
|
||||||
uint division_limit= key_cache->param_division_limit;
|
uint division_limit= key_cache->param_division_limit;
|
||||||
uint age_threshold= key_cache->param_age_threshold;
|
uint age_threshold= key_cache->param_age_threshold;
|
||||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||||
|
@ -4571,8 +4571,13 @@ int reassign_keycache_tables(THD *thd, KEY_CACHE *src_cache,
|
|||||||
bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_preload_keys");
|
DBUG_ENTER("mysql_preload_keys");
|
||||||
|
/*
|
||||||
|
We cannot allow concurrent inserts. The storage engine reads
|
||||||
|
directly from the index file, bypassing the cache. It could read
|
||||||
|
outdated information if parallel inserts into cache blocks happen.
|
||||||
|
*/
|
||||||
DBUG_RETURN(mysql_admin_table(thd, tables, 0,
|
DBUG_RETURN(mysql_admin_table(thd, tables, 0,
|
||||||
"preload_keys", TL_READ, 0, 0, 0, 0,
|
"preload_keys", TL_READ_NO_INSERT, 0, 0, 0, 0,
|
||||||
&handler::preload_keys, 0));
|
&handler::preload_keys, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,6 +1227,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
|
|||||||
ulonglong map= ~(ulonglong) 0;
|
ulonglong map= ~(ulonglong) 0;
|
||||||
TABLE_LIST *table_list= table->pos_in_table_list;
|
TABLE_LIST *table_list= table->pos_in_table_list;
|
||||||
my_bool ignore_leaves= table_list->ignore_leaves;
|
my_bool ignore_leaves= table_list->ignore_leaves;
|
||||||
|
char buf[ERRMSGSIZE+20];
|
||||||
|
|
||||||
DBUG_ENTER("ha_myisam::preload_keys");
|
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";
|
errmsg= "Failed to allocate buffer";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
char buf[ERRMSGSIZE+20];
|
|
||||||
my_snprintf(buf, ERRMSGSIZE,
|
my_snprintf(buf, ERRMSGSIZE,
|
||||||
"Failed to read from index file (errno: %d)", my_errno);
|
"Failed to read from index file (errno: %d)", my_errno);
|
||||||
errmsg= buf;
|
errmsg= buf;
|
||||||
|
@ -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 */
|
/* Check whether all indexes use the same block size */
|
||||||
for (i= 1 ; i < keys ; i++)
|
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)
|
if (keyinfo[i].block_length != block_length)
|
||||||
DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
|
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;
|
length= info->preload_buff_size/block_length * block_length;
|
||||||
set_if_bigger(length, block_length);
|
set_if_bigger(length, block_length);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
|
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
|
||||||
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
|
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
|
||||||
|
Reference in New Issue
Block a user