mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Manual merge after improving concurrency for key cache reassignment
This commit is contained in:
@@ -739,6 +739,11 @@ int handler::analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
return HA_ADMIN_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int handler::assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return HA_ADMIN_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int handler::preload_keys(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return HA_ADMIN_NOT_IMPLEMENTED;
|
||||
@@ -1105,27 +1110,61 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
|
||||
|
||||
/* Use key cacheing on all databases */
|
||||
|
||||
void ha_key_cache(void)
|
||||
int ha_key_cache(KEY_CACHE_VAR *key_cache)
|
||||
{
|
||||
/*
|
||||
The following mutex is not really needed as long as keybuff_size is
|
||||
treated as a long value, but we use the mutex here to guard for future
|
||||
changes.
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
long tmp= (long) keybuff_size;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
if (tmp)
|
||||
(void) init_key_cache(tmp);
|
||||
if (!key_cache->cache)
|
||||
{
|
||||
/*
|
||||
The following mutex is not really needed as long as keybuff_size is
|
||||
treated as a long value, but we use the mutex here to guard for future
|
||||
changes.
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
if (!key_cache->block_size)
|
||||
key_cache->block_size= dflt_key_cache_block_size;
|
||||
if (!key_cache->buff_size)
|
||||
key_cache->buff_size= dflt_key_buff_size;
|
||||
long tmp_buff_size= (long) key_cache->buff_size;
|
||||
long tmp_block_size= (long) key_cache->block_size;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return !init_key_cache(&key_cache->cache,
|
||||
tmp_block_size,
|
||||
tmp_buff_size,
|
||||
key_cache);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ha_resize_key_cache(void)
|
||||
if (key_cache->cache)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
long tmp_buff_size= (long) key_cache->buff_size;
|
||||
long tmp_block_size= (long) key_cache->block_size;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return !resize_key_cache(&key_cache->cache, tmp_block_size,
|
||||
tmp_buff_size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ha_change_key_cache_param(KEY_CACHE_VAR *key_cache)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
long tmp= (long) keybuff_size;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
(void) resize_key_cache(tmp);
|
||||
if (key_cache->cache)
|
||||
{
|
||||
change_key_cache_param(key_cache->cache);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ha_end_key_cache(KEY_CACHE_VAR *key_cache)
|
||||
{
|
||||
if (key_cache->cache)
|
||||
{
|
||||
end_key_cache(&key_cache->cache, 1);
|
||||
return key_cache->cache ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user