Commit ef0b2387 authored by Rich Prohaska's avatar Rich Prohaska

#128 change tokudb_lock_timeout to session variable

parent daf90b1b
...@@ -178,7 +178,6 @@ void toku_hton_update_primary_key_bytes_inserted(uint64_t row_size) { ...@@ -178,7 +178,6 @@ void toku_hton_update_primary_key_bytes_inserted(uint64_t row_size) {
increment_partitioned_counter(tokudb_primary_key_bytes_inserted, row_size); increment_partitioned_counter(tokudb_primary_key_bytes_inserted, row_size);
} }
static ulonglong tokudb_lock_timeout;
static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid); static void tokudb_lock_timeout_callback(DB *db, uint64_t requesting_txnid, const DBT *left_key, const DBT *right_key, uint64_t blocking_txnid);
static ulong tokudb_cleaner_period; static ulong tokudb_cleaner_period;
static ulong tokudb_cleaner_iterations; static ulong tokudb_cleaner_iterations;
...@@ -476,7 +475,7 @@ static int tokudb_init_func(void *p) { ...@@ -476,7 +475,7 @@ static int tokudb_init_func(void *p) {
r = db_env->cleaner_set_iterations(db_env, tokudb_cleaner_iterations); r = db_env->cleaner_set_iterations(db_env, tokudb_cleaner_iterations);
assert(r == 0); assert(r == 0);
r = db_env->set_lock_timeout(db_env, tokudb_lock_timeout); r = db_env->set_lock_timeout(db_env, DEFAULT_TOKUDB_LOCK_TIMEOUT, tokudb_get_lock_wait_time_callback);
assert(r == 0); assert(r == 0);
r = db_env->get_engine_status_num_rows (db_env, &toku_global_status_max_rows); r = db_env->get_engine_status_num_rows (db_env, &toku_global_status_max_rows);
...@@ -1156,20 +1155,6 @@ static void tokudb_cleanup_log_files(void) { ...@@ -1156,20 +1155,6 @@ static void tokudb_cleanup_log_files(void) {
// system variables // system variables
static void tokudb_lock_timeout_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) {
ulonglong *timeout = (ulonglong *) var;
*timeout = *(const ulonglong *) save;
db_env->set_lock_timeout(db_env, *timeout);
}
#define DEFAULT_LOCK_TIMEOUT_MSEC 4000
static MYSQL_SYSVAR_ULONGLONG(lock_timeout, tokudb_lock_timeout,
0, "TokuDB lock timeout",
NULL, tokudb_lock_timeout_update, DEFAULT_LOCK_TIMEOUT_MSEC,
0, ~0ULL, 0);
static void tokudb_cleaner_period_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) { static void tokudb_cleaner_period_update(THD * thd, struct st_mysql_sys_var * sys_var, void * var, const void * save) {
ulong * cleaner_period = (ulong *) var; ulong * cleaner_period = (ulong *) var;
*cleaner_period = *(const ulonglong *) save; *cleaner_period = *(const ulonglong *) save;
......
...@@ -341,6 +341,25 @@ static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB loc ...@@ -341,6 +341,25 @@ static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB loc
static MYSQL_THDVAR_BOOL(hide_default_row_format, 0, "hide the default row format", NULL /*check*/, NULL /*update*/, false); static MYSQL_THDVAR_BOOL(hide_default_row_format, 0, "hide the default row format", NULL /*check*/, NULL /*update*/, false);
#define DEFAULT_TOKUDB_LOCK_TIMEOUT 4000 /*milliseconds*/
static MYSQL_THDVAR_ULONGLONG(lock_timeout,
0,
"lock timeout",
NULL,
NULL,
DEFAULT_TOKUDB_LOCK_TIMEOUT, /*default*/
0, /*min*/
~0ULL, /*max*/
1 /*blocksize*/
);
static uint64_t tokudb_get_lock_wait_time_callback(uint64_t default_wait_time) {
THD *thd = current_thd;
uint64_t wait_time = THDVAR(thd, lock_timeout);
return wait_time;
}
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_mutex;
extern pthread_mutex_t tokudb_meta_mutex; extern pthread_mutex_t tokudb_meta_mutex;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment