Commit 91d570d0 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2356], make lock wait on reads user controlled

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@17986 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3a57fdf9
This diff is collapsed.
...@@ -244,6 +244,8 @@ private: ...@@ -244,6 +244,8 @@ private:
// //
char write_status_msg[200]; //buffer of 200 should be a good upper bound. char write_status_msg[200]; //buffer of 200 should be a good upper bound.
ulonglong read_lock_wait_time;
bool fix_rec_buff_for_blob(ulong length); bool fix_rec_buff_for_blob(ulong length);
void fix_mult_rec_buff(); void fix_mult_rec_buff();
uchar current_ident[TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH]; uchar current_ident[TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH];
......
...@@ -62,6 +62,18 @@ static MYSQL_THDVAR_ULONGLONG(write_lock_wait, ...@@ -62,6 +62,18 @@ static MYSQL_THDVAR_ULONGLONG(write_lock_wait,
1 // blocksize 1 // blocksize
); );
static MYSQL_THDVAR_ULONGLONG(read_lock_wait,
0,
"time waiting for read lock",
NULL,
NULL,
4000, // default
0, // min?
ULONGLONG_MAX, // max
1 // blocksize
);
static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer); static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer);
static void tokudb_cleanup_log_files(void); static void tokudb_cleanup_log_files(void);
static int tokudb_end(handlerton * hton, ha_panic_function type); static int tokudb_end(handlerton * hton, ha_panic_function type);
...@@ -446,6 +458,12 @@ ulonglong get_write_lock_wait_time (THD* thd) { ...@@ -446,6 +458,12 @@ ulonglong get_write_lock_wait_time (THD* thd) {
return (ret_val == 0) ? ULONGLONG_MAX : ret_val; return (ret_val == 0) ? ULONGLONG_MAX : ret_val;
} }
ulonglong get_read_lock_wait_time (THD* thd) {
ulonglong ret_val = THDVAR(thd, read_lock_wait);
return (ret_val == 0) ? ULONGLONG_MAX : ret_val;
}
static int tokudb_commit(handlerton * hton, THD * thd, bool all) { static int tokudb_commit(handlerton * hton, THD * thd, bool all) {
TOKUDB_DBUG_ENTER("tokudb_commit"); TOKUDB_DBUG_ENTER("tokudb_commit");
DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt")); DBUG_PRINT("trans", ("ending transaction %s", all ? "all" : "stmt"));
...@@ -1032,6 +1050,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1032,6 +1050,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(debug), MYSQL_SYSVAR(debug),
MYSQL_SYSVAR(commit_sync), MYSQL_SYSVAR(commit_sync),
MYSQL_SYSVAR(write_lock_wait), MYSQL_SYSVAR(write_lock_wait),
MYSQL_SYSVAR(read_lock_wait),
MYSQL_SYSVAR(version), MYSQL_SYSVAR(version),
MYSQL_SYSVAR(init_flags), MYSQL_SYSVAR(init_flags),
MYSQL_SYSVAR(checkpointing_period), MYSQL_SYSVAR(checkpointing_period),
......
...@@ -12,6 +12,7 @@ extern DB *metadata_db; ...@@ -12,6 +12,7 @@ extern DB *metadata_db;
// thread variables // thread variables
ulonglong get_write_lock_wait_time (THD* thd); ulonglong get_write_lock_wait_time (THD* thd);
ulonglong get_read_lock_wait_time (THD* thd);
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_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