101
101
static void fix_session_mem_root(Session *session, enum_var_type type);
102
102
static void fix_trans_mem_root(Session *session, enum_var_type type);
103
103
static void fix_server_id(Session *session, enum_var_type type);
104
static uint64_t fix_unsigned(Session *, uint64_t, const struct my_option *);
105
104
static bool get_unsigned32(Session *session, set_var *var);
106
105
static bool get_unsigned64(Session *session, set_var *var);
107
106
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
142
141
static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size",
143
142
&SV::join_buff_size);
144
static sys_var_key_buffer_size sys_key_buffer_size(&vars, "key_buffer_size");
145
static sys_var_key_cache_uint32_t sys_key_cache_block_size(&vars, "key_cache_block_size",
148
static sys_var_key_cache_uint32_t sys_key_cache_division_limit(&vars, "key_cache_division_limit",
150
param_division_limit));
151
static sys_var_key_cache_uint32_t sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
153
param_age_threshold));
154
143
static sys_var_session_uint32_t sys_max_allowed_packet(&vars, "max_allowed_packet",
155
144
&SV::max_allowed_packet);
156
145
static sys_var_uint64_t_ptr sys_max_connect_errors(&vars, "max_connect_errors",
1227
1216
return cs ? (unsigned char*) cs->name : (unsigned char*) "NULL";
1231
unsigned char *sys_var_key_cache_param::value_ptr(Session *, enum_var_type,
1234
return (unsigned char*) dflt_key_cache + offset ;
1240
static int resize_key_cache_with_lock(KEY_CACHE *key_cache)
1242
assert(key_cache->key_cache_inited);
1244
pthread_mutex_lock(&LOCK_global_system_variables);
1245
long tmp_buff_size= (long) key_cache->param_buff_size;
1246
long tmp_block_size= (long) key_cache->param_block_size;
1247
uint32_t division_limit= key_cache->param_division_limit;
1248
uint32_t age_threshold= key_cache->param_age_threshold;
1249
pthread_mutex_unlock(&LOCK_global_system_variables);
1251
return(!resize_key_cache(key_cache, tmp_block_size,
1253
division_limit, age_threshold));
1256
sys_var_key_buffer_size::sys_var_key_buffer_size(sys_var_chain *chain,
1257
const char *name_arg)
1258
: sys_var_key_cache_param(chain, name_arg,
1259
offsetof(KEY_CACHE, param_buff_size))
1262
bool sys_var_key_buffer_size::update(Session *session, set_var *var)
1264
uint64_t tmp= var->save_result.uint64_t_value;
1265
KEY_CACHE *key_cache;
1268
pthread_mutex_lock(&LOCK_global_system_variables);
1269
key_cache= dflt_key_cache;
1272
Abort if some other thread is changing the key cache
1273
TODO: This should be changed so that we wait until the previous
1274
assignment is done and then do the new assign
1276
if (key_cache->in_init)
1279
if (tmp == 0) // Zero size means delete
1281
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1282
ER_WARN_CANT_DROP_DEFAULT_KEYCACHE,
1283
ER(ER_WARN_CANT_DROP_DEFAULT_KEYCACHE));
1284
goto end; // Ignore default key cache
1287
key_cache->param_buff_size=
1288
(uint64_t) fix_unsigned(session, tmp, option_limits);
1290
/* If key cache didn't existed initialize it, else resize it */
1291
key_cache->in_init= 1;
1292
pthread_mutex_unlock(&LOCK_global_system_variables);
1294
error= (bool)(resize_key_cache_with_lock(key_cache));
1296
pthread_mutex_lock(&LOCK_global_system_variables);
1297
key_cache->in_init= 0;
1300
pthread_mutex_unlock(&LOCK_global_system_variables);
1307
Abort if some other thread is changing the key cache.
1308
This should be changed so that we wait until the previous
1309
assignment is done and then do the new assign
1311
bool sys_var_key_cache_uint32_t::update(Session *session, set_var *var)
1313
uint64_t tmp= (uint64_t) var->value->val_int();
1316
pthread_mutex_lock(&LOCK_global_system_variables);
1319
Abort if some other thread is changing the key cache
1320
TODO: This should be changed so that we wait until the previous
1321
assignment is done and then do the new assign
1323
if (dflt_key_cache->in_init)
1326
*((uint32_t*) (((char*) dflt_key_cache) + offset))=
1327
(uint32_t) fix_unsigned(session, tmp, option_limits);
1330
Don't create a new key cache if it didn't exist
1331
(key_caches are created only when the user sets block_size)
1333
dflt_key_cache->in_init= 1;
1335
pthread_mutex_unlock(&LOCK_global_system_variables);
1337
error= (bool) (resize_key_cache_with_lock(dflt_key_cache));
1339
pthread_mutex_lock(&LOCK_global_system_variables);
1340
dflt_key_cache->in_init= 0;
1343
pthread_mutex_unlock(&LOCK_global_system_variables);
1348
1219
/****************************************************************************/
1350
1221
bool sys_var_timestamp::update(Session *session, set_var *var)