Commit a0cd739a authored by Rich Prohaska's avatar Rich Prohaska

#189 add tokudb_kill_time session variable to set lock tree kill callback frequency

parent 5c9c570e
...@@ -494,6 +494,8 @@ static int tokudb_init_func(void *p) { ...@@ -494,6 +494,8 @@ static int tokudb_init_func(void *p) {
r = db_env->set_lock_timeout(db_env, DEFAULT_TOKUDB_LOCK_TIMEOUT, tokudb_get_lock_wait_time_callback); r = db_env->set_lock_timeout(db_env, DEFAULT_TOKUDB_LOCK_TIMEOUT, tokudb_get_lock_wait_time_callback);
assert(r == 0); assert(r == 0);
db_env->set_killed_callback(db_env, DEFAULT_TOKUDB_KILLED_TIME, tokudb_get_killed_time_callback, tokudb_killed_callback);
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);
assert(r == 0); assert(r == 0);
...@@ -1283,6 +1285,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1283,6 +1285,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(lock_timeout_debug), MYSQL_SYSVAR(lock_timeout_debug),
MYSQL_SYSVAR(loader_memory_size), MYSQL_SYSVAR(loader_memory_size),
MYSQL_SYSVAR(hide_default_row_format), MYSQL_SYSVAR(hide_default_row_format),
MYSQL_SYSVAR(killed_time),
NULL NULL
}; };
......
...@@ -348,18 +348,9 @@ static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB loc ...@@ -348,18 +348,9 @@ 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*/, true); static MYSQL_THDVAR_BOOL(hide_default_row_format, 0, "hide the default row format", NULL /*check*/, NULL /*update*/, true);
#define DEFAULT_TOKUDB_LOCK_TIMEOUT 4000 /*milliseconds*/ static const uint64_t DEFAULT_TOKUDB_LOCK_TIMEOUT = 4000; /*milliseconds*/
static MYSQL_THDVAR_ULONGLONG(lock_timeout, static MYSQL_THDVAR_ULONGLONG(lock_timeout, 0, "TokuDB lock timeout", NULL, NULL, DEFAULT_TOKUDB_LOCK_TIMEOUT, 0 /*min*/, ~0ULL /*max*/, 1 /*blocksize*/);
0,
"TokuDB 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) { static uint64_t tokudb_get_lock_wait_time_callback(uint64_t default_wait_time) {
THD *thd = current_thd; THD *thd = current_thd;
...@@ -384,6 +375,21 @@ static uint64_t tokudb_get_loader_memory_size_callback(void) { ...@@ -384,6 +375,21 @@ static uint64_t tokudb_get_loader_memory_size_callback(void) {
return memory_size; return memory_size;
} }
static const uint64_t DEFAULT_TOKUDB_KILLED_TIME = 4000;
static MYSQL_THDVAR_ULONGLONG(killed_time, 0, "TokuDB killed time", NULL, NULL, DEFAULT_TOKUDB_KILLED_TIME, 0 /*min*/, ~0ULL /*max*/, 1 /*blocksize*/);
static uint64_t tokudb_get_killed_time_callback(uint64_t default_killed_time) {
THD *thd = current_thd;
uint64_t killed_time = THDVAR(thd, killed_time);
return killed_time;
}
static int tokudb_killed_callback(void) {
THD *thd = current_thd;
return thd->killed;
}
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_mutex;
extern uint32_t tokudb_write_status_frequency; extern uint32_t tokudb_write_status_frequency;
......
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