summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2013-09-19 13:34:55 -0400
committerRich Prohaska <prohaska@tokutek.com>2013-09-19 13:34:55 -0400
commit9f5293de5b36b760ec2f8a06d7c06467c8c36d85 (patch)
tree1161e5091ef71303d619460c1793e560fe962485 /storage
parent2ec07a2988658fa510b83f3e8eac00c9e7f7f9fd (diff)
downloadmariadb-git-9f5293de5b36b760ec2f8a06d7c06467c8c36d85.tar.gz
#81 cleanup thread variables
Diffstat (limited to 'storage')
-rw-r--r--storage/tokudb/ha_tokudb.cc10
-rw-r--r--storage/tokudb/ha_tokudb_admin.cc2
-rw-r--r--storage/tokudb/hatoku_hton.cc239
-rw-r--r--storage/tokudb/hatoku_hton.h259
4 files changed, 243 insertions, 267 deletions
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 8937e0c465e..c7660abeed3 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -8145,16 +8145,6 @@ void ha_tokudb::print_error(int error, myf errflag) {
error = HA_ERR_UNSUPPORTED;
}
#endif
- // TODO: should rename debug code to something better
- // just reusing this so that tests don' start complaining
-#if MYSQL_VERSION_ID < 50500
- if ((tokudb_debug & TOKUDB_DEBUG_HIDE_DDL_LOCK_ERRORS) == 0) {
- THD* thd = ha_thd();
- if (get_log_client_errors(thd)) {
- sql_print_error("query \"%s\" returned handler error %d", thd->query_string.str, error);
- }
- }
-#endif
handler::print_error(error, errflag);
}
diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc
index 6409474b18f..728bb93b012 100644
--- a/storage/tokudb/ha_tokudb_admin.cc
+++ b/storage/tokudb/ha_tokudb_admin.cc
@@ -106,7 +106,7 @@ static int analyze_progress(void *v_extra, uint64_t rows) {
return ER_ABORTING_CONNECTION;
time_t t_now = time(0);
- time_t t_limit = get_analyze_time(thd);
+ time_t t_limit = THDVAR(thd, analyze_time);
time_t t_start = extra->t_start;
if (t_limit > 0 && t_now - t_start > t_limit)
return ETIME;
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index c3de96a9587..e997d17183e 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -132,188 +132,6 @@ static uchar *tokudb_get_key(TOKUDB_SHARE * share, size_t * length, my_bool not_
static handler *tokudb_create_handler(handlerton * hton, TABLE_SHARE * table, MEM_ROOT * mem_root);
-static MYSQL_THDVAR_BOOL(commit_sync,
- PLUGIN_VAR_THDLOCAL,
- "sync on txn commit",
- /* check */ NULL,
- /* update */ NULL,
- /* default*/ true
-);
-static MYSQL_THDVAR_UINT(pk_insert_mode,
- 0,
- "set the primary key insert mode",
- NULL,
- NULL,
- 1, // default
- 0, // min?
- 2, // max
- 1 // blocksize
-);
-static MYSQL_THDVAR_BOOL(load_save_space,
- 0,
- "if on, intial loads are slower but take less space",
- NULL,
- NULL,
- false
-);
-static MYSQL_THDVAR_BOOL(disable_slow_alter,
- 0,
- "if on, alter tables that require copy are disabled",
- NULL,
- NULL,
- false
-);
-static MYSQL_THDVAR_BOOL(disable_hot_alter,
- 0,
- "if on, hot alter table is disabled",
- NULL,
- NULL,
- false
-);
-static MYSQL_THDVAR_BOOL(create_index_online,
- 0,
- "if on, create index done online",
- NULL,
- NULL,
- true
-);
-static MYSQL_THDVAR_BOOL(disable_prefetching,
- 0,
- "if on, prefetching disabled",
- NULL,
- NULL,
- false
-);
-static MYSQL_THDVAR_BOOL(prelock_empty,
- 0,
- "Tokudb Prelock Empty Table",
- NULL,
- NULL,
- true
-);
-static MYSQL_THDVAR_BOOL(log_client_errors,
- 0,
- "Tokudb Log Client Errors",
- NULL,
- NULL,
- false
-);
-static MYSQL_THDVAR_UINT(block_size,
- 0,
- "fractal tree block size",
- NULL,
- NULL,
- 4<<20, // default
- 4096, // min
- ~0U, // max
- 1 // blocksize???
-);
-static MYSQL_THDVAR_UINT(read_block_size,
- 0,
- "fractal tree read block size",
- NULL,
- NULL,
- 128*1024, // default
- 4096, // min
- ~0U, // max
- 1 // blocksize???
-);
-static MYSQL_THDVAR_UINT(read_buf_size,
- 0,
- "fractal tree read block size", //TODO: Is this a typo?
- NULL,
- NULL,
- 128*1024, // default
- 0, // min
- 1*1024*1024, // max
- 1 // blocksize???
-);
-#if TOKU_INCLUDE_UPSERT
-static MYSQL_THDVAR_BOOL(disable_slow_update,
- PLUGIN_VAR_THDLOCAL,
- "disable slow update",
- NULL, // check
- NULL, // update
- false // default
-);
-static MYSQL_THDVAR_BOOL(disable_slow_upsert,
- PLUGIN_VAR_THDLOCAL,
- "disable slow upsert",
- NULL, // check
- NULL, // update
- false // default
-);
-#endif
-static MYSQL_THDVAR_UINT(analyze_time,
- 0,
- "analyze time",
- NULL,
- NULL,
- 60, // default
- 0, // min
- ~0U, // max
- 1 // blocksize???
-);
-
-static void tokudb_checkpoint_lock(THD * thd);
-static void tokudb_checkpoint_unlock(THD * thd);
-
-static void tokudb_checkpoint_lock_update(
- THD* thd,
- struct st_mysql_sys_var* var,
- void* var_ptr,
- const void* save)
-{
- my_bool* val = (my_bool *) var_ptr;
- *val= *(my_bool *) save ? true : false;
- if (*val) {
- tokudb_checkpoint_lock(thd);
- }
- else {
- tokudb_checkpoint_unlock(thd);
- }
-}
-
-static MYSQL_THDVAR_BOOL(checkpoint_lock,
- 0,
- "Tokudb Checkpoint Lock",
- NULL,
- tokudb_checkpoint_lock_update,
- false
-);
-
-static const char *tokudb_row_format_names[] = {
- "tokudb_uncompressed",
- "tokudb_zlib",
- "tokudb_quicklz",
- "tokudb_lzma",
- "tokudb_fast",
- "tokudb_small",
- "tokudb_default",
- NullS
-};
-
-static TYPELIB tokudb_row_format_typelib = {
- array_elements(tokudb_row_format_names) - 1,
- "tokudb_row_format_typelib",
- tokudb_row_format_names,
- NULL
-};
-
-static MYSQL_THDVAR_ENUM(row_format, PLUGIN_VAR_OPCMDARG,
- "Specifies the compression method for a table during this session. "
- "Possible values are TOKUDB_UNCOMPRESSED, TOKUDB_ZLIB, TOKUDB_QUICKLZ, "
- "TOKUDB_LZMA, TOKUDB_FAST, TOKUDB_SMALL and TOKUDB_DEFAULT",
- NULL, NULL, SRV_ROW_FORMAT_DEFAULT, &tokudb_row_format_typelib);
-
-srv_row_format_t get_row_format(THD *thd)
-{
- return (srv_row_format_t) THDVAR(thd, row_format);
-}
-
-static MYSQL_THDVAR_UINT(lock_timeout_debug, 0, "TokuDB lock timeout debug", NULL, NULL, 0, 0, ~0U, 1);
-
-static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB lock timeout", NULL, NULL, NULL);
static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer);
static void tokudb_cleanup_log_files(void);
@@ -804,62 +622,6 @@ exit:
TOKUDB_DBUG_RETURN(result);
}
-uint get_pk_insert_mode(THD* thd) {
- return THDVAR(thd, pk_insert_mode);
-}
-
-bool get_load_save_space(THD* thd) {
- return (THDVAR(thd, load_save_space) != 0);
-}
-
-bool get_disable_slow_alter(THD* thd) {
- return (THDVAR(thd, disable_slow_alter) != 0);
-}
-
-bool get_disable_hot_alter(THD* thd) {
- return THDVAR(thd, disable_hot_alter) != 0;
-}
-
-bool get_create_index_online(THD* thd) {
- return (THDVAR(thd, create_index_online) != 0);
-}
-
-bool get_disable_prefetching(THD* thd) {
- return (THDVAR(thd, disable_prefetching) != 0);
-}
-
-bool get_prelock_empty(THD* thd) {
- return (THDVAR(thd, prelock_empty) != 0);
-}
-
-bool get_log_client_errors(THD* thd) {
- return (THDVAR(thd, log_client_errors) != 0);
-}
-
-uint get_tokudb_block_size(THD* thd) {
- return THDVAR(thd, block_size);
-}
-
-uint get_tokudb_read_block_size(THD* thd) {
- return THDVAR(thd, read_block_size);
-}
-
-uint get_tokudb_read_buf_size(THD* thd) {
- return THDVAR(thd, read_buf_size);
-}
-
-#if TOKU_INCLUDE_UPSERT
-bool get_disable_slow_update(THD *thd) {
- return (THDVAR(thd, disable_slow_update) != 0);
-}
-
-bool get_disable_slow_upsert(THD *thd) {
- return (THDVAR(thd, disable_slow_upsert) != 0);
-}
-#endif
-uint get_analyze_time(THD *thd) {
- return THDVAR(thd, analyze_time);
-}
typedef struct txn_progress_info {
char status[200];
@@ -1505,7 +1267,6 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(init_flags),
MYSQL_SYSVAR(checkpointing_period),
MYSQL_SYSVAR(prelock_empty),
- MYSQL_SYSVAR(log_client_errors),
MYSQL_SYSVAR(checkpoint_lock),
MYSQL_SYSVAR(write_status_frequency),
MYSQL_SYSVAR(read_status_frequency),
diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h
index e07ac741d94..dc3d68443fd 100644
--- a/storage/tokudb/hatoku_hton.h
+++ b/storage/tokudb/hatoku_hton.h
@@ -109,25 +109,250 @@ enum srv_row_format_enum {
typedef enum srv_row_format_enum srv_row_format_t;
// thread variables
-uint get_pk_insert_mode(THD* thd);
-bool get_load_save_space(THD* thd);
-bool get_disable_slow_alter(THD* thd);
-bool get_disable_hot_alter(THD* thd);
-bool get_create_index_online(THD* thd);
-bool get_disable_prefetching(THD* thd);
-bool get_prelock_empty(THD* thd);
-bool get_log_client_errors(THD* thd);
-uint get_tokudb_block_size(THD* thd);
-uint get_tokudb_read_block_size(THD* thd);
-uint get_tokudb_read_buf_size(THD* thd);
-srv_row_format_t get_row_format(THD *thd);
+
+static MYSQL_THDVAR_BOOL(commit_sync,
+ PLUGIN_VAR_THDLOCAL,
+ "sync on txn commit",
+ /* check */ NULL,
+ /* update */ NULL,
+ /* default*/ true
+);
+
+static MYSQL_THDVAR_UINT(pk_insert_mode,
+ 0,
+ "set the primary key insert mode",
+ NULL,
+ NULL,
+ 1, // default
+ 0, // min?
+ 2, // max
+ 1 // blocksize
+);
+
+static uint get_pk_insert_mode(THD* thd) {
+ return THDVAR(thd, pk_insert_mode);
+}
+
+
+static MYSQL_THDVAR_BOOL(load_save_space,
+ 0,
+ "if on, intial loads are slower but take less space",
+ NULL,
+ NULL,
+ false
+);
+
+static bool get_load_save_space(THD* thd) {
+ return (THDVAR(thd, load_save_space) != 0);
+}
+
+static MYSQL_THDVAR_BOOL(disable_slow_alter,
+ 0,
+ "if on, alter tables that require copy are disabled",
+ NULL,
+ NULL,
+ false
+);
+
+static bool get_disable_slow_alter(THD* thd) {
+ return (THDVAR(thd, disable_slow_alter) != 0);
+}
+
+static MYSQL_THDVAR_BOOL(disable_hot_alter,
+ 0,
+ "if on, hot alter table is disabled",
+ NULL,
+ NULL,
+ false
+);
+
+static bool get_disable_hot_alter(THD* thd) {
+ return THDVAR(thd, disable_hot_alter) != 0;
+}
+
+static MYSQL_THDVAR_BOOL(create_index_online,
+ 0,
+ "if on, create index done online",
+ NULL,
+ NULL,
+ true
+);
+
+static bool get_create_index_online(THD* thd) {
+ return (THDVAR(thd, create_index_online) != 0);
+}
+
+static MYSQL_THDVAR_BOOL(disable_prefetching,
+ 0,
+ "if on, prefetching disabled",
+ NULL,
+ NULL,
+ false
+);
+
+static bool get_disable_prefetching(THD* thd) {
+ return (THDVAR(thd, disable_prefetching) != 0);
+}
+
+static MYSQL_THDVAR_BOOL(prelock_empty,
+ 0,
+ "Tokudb Prelock Empty Table",
+ NULL,
+ NULL,
+ true
+);
+
+static bool get_prelock_empty(THD* thd) {
+ return (THDVAR(thd, prelock_empty) != 0);
+}
+
+static MYSQL_THDVAR_UINT(block_size,
+ 0,
+ "fractal tree block size",
+ NULL,
+ NULL,
+ 4<<20, // default
+ 4096, // min
+ ~0U, // max
+ 1 // blocksize???
+);
+
+static uint get_tokudb_block_size(THD* thd) {
+ return THDVAR(thd, block_size);
+}
+
+static MYSQL_THDVAR_UINT(read_block_size,
+ 0,
+ "fractal tree read block size",
+ NULL,
+ NULL,
+ 128*1024, // default
+ 4096, // min
+ ~0U, // max
+ 1 // blocksize???
+);
+
+static uint get_tokudb_read_block_size(THD* thd) {
+ return THDVAR(thd, read_block_size);
+}
+
+static MYSQL_THDVAR_UINT(read_buf_size,
+ 0,
+ "fractal tree read block size", //TODO: Is this a typo?
+ NULL,
+ NULL,
+ 128*1024, // default
+ 0, // min
+ 1*1024*1024, // max
+ 1 // blocksize???
+);
+
+static uint get_tokudb_read_buf_size(THD* thd) {
+ return THDVAR(thd, read_buf_size);
+}
+
#if TOKU_INCLUDE_UPSERT
-bool get_enable_fast_update(THD *thd);
-bool get_disable_slow_update(THD *thd);
-bool get_enable_fast_upsert(THD *thd);
-bool get_disable_slow_upsert(THD *thd);
+static MYSQL_THDVAR_BOOL(disable_slow_update,
+ PLUGIN_VAR_THDLOCAL,
+ "disable slow update",
+ NULL, // check
+ NULL, // update
+ false // default
+);
+
+static bool get_disable_slow_update(THD *thd) {
+ return (THDVAR(thd, disable_slow_update) != 0);
+}
+
+static MYSQL_THDVAR_BOOL(disable_slow_upsert,
+ PLUGIN_VAR_THDLOCAL,
+ "disable slow upsert",
+ NULL, // check
+ NULL, // update
+ false // default
+);
+
+static bool get_disable_slow_upsert(THD *thd) {
+ return (THDVAR(thd, disable_slow_upsert) != 0);
+}
#endif
-uint get_analyze_time(THD *thd);
+
+static MYSQL_THDVAR_UINT(analyze_time,
+ 0,
+ "analyze time",
+ NULL,
+ NULL,
+ 60, // default
+ 0, // min
+ ~0U, // max
+ 1 // blocksize???
+);
+
+static void tokudb_checkpoint_lock(THD * thd);
+static void tokudb_checkpoint_unlock(THD * thd);
+
+static void tokudb_checkpoint_lock_update(
+ THD* thd,
+ struct st_mysql_sys_var* var,
+ void* var_ptr,
+ const void* save)
+{
+ my_bool* val = (my_bool *) var_ptr;
+ *val= *(my_bool *) save ? true : false;
+ if (*val) {
+ tokudb_checkpoint_lock(thd);
+ }
+ else {
+ tokudb_checkpoint_unlock(thd);
+ }
+}
+
+static MYSQL_THDVAR_BOOL(checkpoint_lock,
+ 0,
+ "Tokudb Checkpoint Lock",
+ NULL,
+ tokudb_checkpoint_lock_update,
+ false
+);
+
+static const char *tokudb_row_format_names[] = {
+ "tokudb_uncompressed",
+ "tokudb_zlib",
+ "tokudb_quicklz",
+ "tokudb_lzma",
+ "tokudb_fast",
+ "tokudb_small",
+ "tokudb_default",
+ NullS
+};
+
+static TYPELIB tokudb_row_format_typelib = {
+ array_elements(tokudb_row_format_names) - 1,
+ "tokudb_row_format_typelib",
+ tokudb_row_format_names,
+ NULL
+};
+
+static MYSQL_THDVAR_ENUM(row_format, PLUGIN_VAR_OPCMDARG,
+ "Specifies the compression method for a table during this session. "
+ "Possible values are TOKUDB_UNCOMPRESSED, TOKUDB_ZLIB, TOKUDB_QUICKLZ, "
+ "TOKUDB_LZMA, TOKUDB_FAST, TOKUDB_SMALL and TOKUDB_DEFAULT",
+ NULL, NULL, SRV_ROW_FORMAT_DEFAULT, &tokudb_row_format_typelib);
+
+static srv_row_format_t get_row_format(THD *thd)
+{
+ return (srv_row_format_t) THDVAR(thd, row_format);
+}
+
+static MYSQL_THDVAR_UINT(lock_timeout_debug, 0, "TokuDB lock timeout debug", NULL, NULL, 0, 0, ~0U, 1);
+
+static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB lock timeout", NULL, NULL, NULL);
+
+
+
+
+
+
extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex;