Commit 19326918 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:3997], merge handlerton changes

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@36690 c7de825b-a66e-492c-adef-691d508d4ae1
parent a28e926d
...@@ -1521,7 +1521,7 @@ int tokudb_compare_two_keys( ...@@ -1521,7 +1521,7 @@ int tokudb_compare_two_keys(
return ret_val; return ret_val;
} }
int tokudb_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb) { int tokudb_cmp_dbt_key(DB* file, const DBT *keya, const DBT *keyb) {
int cmp; int cmp;
if (file->descriptor->dbt.size == 0) { if (file->descriptor->dbt.size == 0) {
int num_bytes_cmp = keya->size < keyb->size ? int num_bytes_cmp = keya->size < keyb->size ?
......
...@@ -277,7 +277,7 @@ int tokudb_compare_two_keys( ...@@ -277,7 +277,7 @@ int tokudb_compare_two_keys(
); );
int tokudb_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb); int tokudb_cmp_dbt_key(DB* db, const DBT *keya, const DBT *keyb);
//TODO: QQQ Only do one direction for prefix. //TODO: QQQ Only do one direction for prefix.
int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb); int tokudb_prefix_cmp_dbt_key(DB *file, const DBT *keya, const DBT *keyb);
......
...@@ -189,6 +189,8 @@ pthread_mutex_t tokudb_mutex; ...@@ -189,6 +189,8 @@ pthread_mutex_t tokudb_mutex;
pthread_mutex_t tokudb_meta_mutex; pthread_mutex_t tokudb_meta_mutex;
static ulonglong tokudb_lock_timeout; static ulonglong tokudb_lock_timeout;
static ulong tokudb_cleaner_period;
static ulong tokudb_cleaner_iterations;
//my_bool tokudb_shared_data = FALSE; //my_bool tokudb_shared_data = FALSE;
static u_int32_t tokudb_init_flags = static u_int32_t tokudb_init_flags =
...@@ -444,6 +446,10 @@ static int tokudb_init_func(void *p) { ...@@ -444,6 +446,10 @@ static int tokudb_init_func(void *p) {
r = db_env->checkpointing_set_period(db_env, tokudb_checkpointing_period); r = db_env->checkpointing_set_period(db_env, tokudb_checkpointing_period);
assert(!r); assert(!r);
r = db_env->cleaner_set_period(db_env, tokudb_cleaner_period);
assert(r == 0);
r = db_env->cleaner_set_iterations(db_env, tokudb_cleaner_iterations);
assert(r == 0);
r = db_env->set_lock_timeout(db_env, tokudb_lock_timeout); r = db_env->set_lock_timeout(db_env, tokudb_lock_timeout);
assert(r == 0); assert(r == 0);
...@@ -1158,6 +1164,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1158,6 +1164,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
STATPRINT("checkpoints taken ", buf); STATPRINT("checkpoints taken ", buf);
snprintf(buf, bufsiz, "%" PRIu32, engstat.checkpoint_count_fail); snprintf(buf, bufsiz, "%" PRIu32, engstat.checkpoint_count_fail);
STATPRINT("checkpoints failed", buf); STATPRINT("checkpoints failed", buf);
snprintf(buf, bufsiz, "%" PRIu32, engstat.cleaner_period);
STATPRINT("cleaner period", buf);
snprintf(buf, bufsiz, "%" PRIu32, engstat.cleaner_iterations);
STATPRINT("cleaner iterations", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.txn_begin); snprintf(buf, bufsiz, "%" PRIu64, engstat.txn_begin);
STATPRINT("txn begin", buf); STATPRINT("txn begin", buf);
...@@ -1306,6 +1316,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1306,6 +1316,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
STATPRINT("cachetable size_leaf", buf); STATPRINT("cachetable size_leaf", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_nonleaf); snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_nonleaf);
STATPRINT("cachetable size_nonleaf", buf); STATPRINT("cachetable size_nonleaf", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_rollback);
STATPRINT("cachetable size_rollback", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_cachepressure);
STATPRINT("cachetable size_cachepressure", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_writing); snprintf(buf, bufsiz, "%" PRIu64, engstat.cachetable_size_writing);
STATPRINT("cachetable size_writing", buf); STATPRINT("cachetable size_writing", buf);
snprintf(buf, bufsiz, "%" PRIu64, engstat.get_and_pin_footprint); snprintf(buf, bufsiz, "%" PRIu64, engstat.get_and_pin_footprint);
...@@ -1608,6 +1622,48 @@ static MYSQL_SYSVAR_ULONGLONG(lock_timeout, tokudb_lock_timeout, ...@@ -1608,6 +1622,48 @@ static MYSQL_SYSVAR_ULONGLONG(lock_timeout, tokudb_lock_timeout,
0, "TokuDB lock timeout", 0, "TokuDB lock timeout",
NULL, tokudb_lock_timeout_update, DEFAULT_LOCK_TIMEOUT_MSEC, NULL, tokudb_lock_timeout_update, DEFAULT_LOCK_TIMEOUT_MSEC,
0, ~0LL, 0); 0, ~0LL, 0);
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;
*cleaner_period = *(const ulong *) save;
int r = db_env->cleaner_set_period(db_env, *cleaner_period);
assert(r==0);
}
#define DEFAULT_CLEANER_PERIOD 1
static MYSQL_SYSVAR_ULONG(cleaner_period, tokudb_cleaner_period,
0, "TokuDB cleaner_period",
NULL, tokudb_cleaner_period_update, DEFAULT_CLEANER_PERIOD,
0, ~0LL, 0);
static void tokudb_cleaner_iterations_update(THD * thd,
struct st_mysql_sys_var * sys_var,
void * var, const void * save)
{
ulong * cleaner_iterations = (ulong *) var;
*cleaner_iterations = *(const ulong *) save;
int r = db_env->cleaner_set_iterations(db_env, *cleaner_iterations);
assert(r==0);
}
#define DEFAULT_CLEANER_ITERATIONS 1
static MYSQL_SYSVAR_ULONG(cleaner_iterations, tokudb_cleaner_iterations,
0, "TokuDB cleaner_iterations",
NULL, tokudb_cleaner_iterations_update, DEFAULT_CLEANER_ITERATIONS,
0, ~0LL, 0);
static MYSQL_SYSVAR_ULONGLONG(cache_size, tokudb_cache_size, static MYSQL_SYSVAR_ULONGLONG(cache_size, tokudb_cache_size,
PLUGIN_VAR_READONLY, "TokuDB cache table size", NULL, NULL, 0, PLUGIN_VAR_READONLY, "TokuDB cache table size", NULL, NULL, 0,
0, ~0LL, 0); 0, ~0LL, 0);
...@@ -1640,6 +1696,8 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1640,6 +1696,8 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
// called tokudb_lock_timeout. this variable defines the maximum // called tokudb_lock_timeout. this variable defines the maximum
// time that threads will wait for a lock to be acquired // time that threads will wait for a lock to be acquired
MYSQL_SYSVAR(lock_timeout), MYSQL_SYSVAR(lock_timeout),
MYSQL_SYSVAR(cleaner_period),
MYSQL_SYSVAR(cleaner_iterations),
// XXX remove the old tokudb_read_lock_wait session variable // XXX remove the old tokudb_read_lock_wait session variable
// XXX remove the old tokudb_write_lock_wait session variable // XXX remove the old tokudb_write_lock_wait session variable
......
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