Commit 10bc6f42 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3147 add tokudb_block_size session variable to allow experimentation refs[t:3147]

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@26782 c7de825b-a66e-492c-adef-691d508d4ae1
parent 68605544
...@@ -5593,8 +5593,7 @@ int toku_dbt_up(DB*, ...@@ -5593,8 +5593,7 @@ int toku_dbt_up(DB*,
return 0; return 0;
} }
static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* txn, uint32_t tokudb_block_size) {
static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* txn) {
TOKUDB_DBUG_ENTER("create_sub_table"); TOKUDB_DBUG_ENTER("create_sub_table");
int error; int error;
DB *file = NULL; DB *file = NULL;
...@@ -5612,6 +5611,14 @@ static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* ...@@ -5612,6 +5611,14 @@ static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN*
DBUG_PRINT("error", ("Got error: %d when setting row descriptor for table '%s'", error, table_name)); DBUG_PRINT("error", ("Got error: %d when setting row descriptor for table '%s'", error, table_name));
goto exit; goto exit;
} }
if (tokudb_block_size != 0) {
error = file->set_pagesize(file, tokudb_block_size);
if (error != 0) {
DBUG_PRINT("error", ("Got error: %d when setting block size %u for table '%s'", error, tokudb_block_size, table_name));
goto exit;
}
}
error = file->open(file, txn, table_name, NULL, DB_BTREE, DB_THREAD | DB_CREATE | DB_EXCL, my_umask); error = file->open(file, txn, table_name, NULL, DB_BTREE, DB_THREAD | DB_CREATE | DB_EXCL, my_umask);
if (error) { if (error) {
...@@ -5730,7 +5737,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k ...@@ -5730,7 +5737,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k
KEY* prim_key = NULL; KEY* prim_key = NULL;
char dict_name[MAX_DICT_NAME_LEN]; char dict_name[MAX_DICT_NAME_LEN];
u_int32_t max_row_desc_buff_size; u_int32_t max_row_desc_buff_size;
THD* thd = ha_thd();
uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0; uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0;
bzero(&row_descriptor, sizeof(row_descriptor)); bzero(&row_descriptor, sizeof(row_descriptor));
...@@ -5790,7 +5797,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k ...@@ -5790,7 +5797,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k
row_descriptor.size = ptr - row_desc_buff; row_descriptor.size = ptr - row_desc_buff;
assert(row_descriptor.size <= max_row_desc_buff_size); assert(row_descriptor.size <= max_row_desc_buff_size);
error = create_sub_table(newname, &row_descriptor, txn); error = create_sub_table(newname, &row_descriptor, txn, get_tokudb_block_size(thd));
cleanup: cleanup:
my_free(newname, MYF(MY_ALLOW_ZERO_PTR)); my_free(newname, MYF(MY_ALLOW_ZERO_PTR));
my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR));
...@@ -5809,7 +5816,7 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn ...@@ -5809,7 +5816,7 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
char* newname = NULL; char* newname = NULL;
KEY* prim_key = NULL; KEY* prim_key = NULL;
u_int32_t max_row_desc_buff_size; u_int32_t max_row_desc_buff_size;
THD* thd = ha_thd();
uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0; uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0;
bzero(&row_descriptor, sizeof(row_descriptor)); bzero(&row_descriptor, sizeof(row_descriptor));
...@@ -5861,7 +5868,7 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn ...@@ -5861,7 +5868,7 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
assert(row_descriptor.size <= max_row_desc_buff_size); assert(row_descriptor.size <= max_row_desc_buff_size);
/* Create the main table that will hold the real rows */ /* Create the main table that will hold the real rows */
error = create_sub_table(newname, &row_descriptor, txn); error = create_sub_table(newname, &row_descriptor, txn, get_tokudb_block_size(thd));
cleanup: cleanup:
my_free(newname, MYF(MY_ALLOW_ZERO_PTR)); my_free(newname, MYF(MY_ALLOW_ZERO_PTR));
my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR)); my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR));
......
...@@ -69,7 +69,6 @@ static MYSQL_THDVAR_ULONGLONG(write_lock_wait, ...@@ -69,7 +69,6 @@ static MYSQL_THDVAR_ULONGLONG(write_lock_wait,
ULONGLONG_MAX, // max ULONGLONG_MAX, // max
1 // blocksize 1 // blocksize
); );
static MYSQL_THDVAR_ULONGLONG(read_lock_wait, static MYSQL_THDVAR_ULONGLONG(read_lock_wait,
0, 0,
"time waiting for read lock", "time waiting for read lock",
...@@ -90,7 +89,6 @@ static MYSQL_THDVAR_UINT(pk_insert_mode, ...@@ -90,7 +89,6 @@ static MYSQL_THDVAR_UINT(pk_insert_mode,
2, // max 2, // max
1 // blocksize 1 // blocksize
); );
static MYSQL_THDVAR_BOOL(load_save_space, static MYSQL_THDVAR_BOOL(load_save_space,
0, 0,
"if on, intial loads are slower but take less space", "if on, intial loads are slower but take less space",
...@@ -112,6 +110,16 @@ static MYSQL_THDVAR_BOOL(prelock_empty, ...@@ -112,6 +110,16 @@ static MYSQL_THDVAR_BOOL(prelock_empty,
NULL, NULL,
TRUE TRUE
); );
static MYSQL_THDVAR_UINT(block_size,
0,
"fractal tree block size",
NULL,
NULL,
4<<20, // default
4096, // min
~0L, // max
1 // blocksize???
);
void tokudb_checkpoint_lock(THD * thd); void tokudb_checkpoint_lock(THD * thd);
void tokudb_checkpoint_unlock(THD * thd); void tokudb_checkpoint_unlock(THD * thd);
...@@ -559,6 +567,10 @@ bool get_prelock_empty(THD* thd) { ...@@ -559,6 +567,10 @@ bool get_prelock_empty(THD* thd) {
return (THDVAR(thd, prelock_empty) != 0); return (THDVAR(thd, prelock_empty) != 0);
} }
uint get_tokudb_block_size(THD* thd) {
return THDVAR(thd, block_size);
}
typedef struct txn_progress_info { typedef struct txn_progress_info {
char status[200]; char status[200];
THD* thd; THD* thd;
...@@ -1414,35 +1426,6 @@ static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0, ...@@ -1414,35 +1426,6 @@ static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0,
static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0); static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0);
static MYSQL_SYSVAR_STR(tmp_dir, tokudb_tmp_dir, PLUGIN_VAR_READONLY, "Tokudb Tmp Dir", NULL, NULL, NULL); static MYSQL_SYSVAR_STR(tmp_dir, tokudb_tmp_dir, PLUGIN_VAR_READONLY, "Tokudb Tmp Dir", NULL, NULL, NULL);
#if 0
static MYSQL_SYSVAR_ULONG(cache_parts, tokudb_cache_parts, PLUGIN_VAR_READONLY, "Sets TokuDB set_cache_parts", NULL, NULL, 0, 0, ~0L, 0);
// this is really a u_int32_t
// ? use MYSQL_SYSVAR_SET
static MYSQL_SYSVAR_UINT(env_flags, tokudb_env_flags, PLUGIN_VAR_READONLY, "Sets TokuDB env_flags", NULL, NULL, DB_LOG_AUTOREMOVE, 0, ~0, 0);
static MYSQL_SYSVAR_STR(home, tokudb_home, PLUGIN_VAR_READONLY, "Sets TokuDB env->open home", NULL, NULL, NULL);
// this is really a u_int32_t
//? use MYSQL_SYSVAR_SET
// this looks to be unused
static MYSQL_SYSVAR_LONG(lock_scan_time, tokudb_lock_scan_time, PLUGIN_VAR_READONLY, "Tokudb Lock Scan Time (UNUSED)", NULL, NULL, 0, 0, ~0L, 0);
// this is really a u_int32_t
//? use MYSQL_SYSVAR_ENUM
static MYSQL_SYSVAR_UINT(lock_type, tokudb_lock_type, PLUGIN_VAR_READONLY, "Sets set_lk_detect", NULL, NULL, DB_LOCK_DEFAULT, 0, ~0, 0);
static MYSQL_SYSVAR_ULONG(log_buffer_size, tokudb_log_buffer_size, PLUGIN_VAR_READONLY, "Tokudb Log Buffer Size", NULL, NULL, 0, 0, ~0L, 0);
static MYSQL_SYSVAR_ULONG(region_size, tokudb_region_size, PLUGIN_VAR_READONLY, "Tokudb Region Size", NULL, NULL, 128 * 1024, 0, ~0L, 0);
static MYSQL_SYSVAR_BOOL(shared_data, tokudb_shared_data, PLUGIN_VAR_READONLY, "Tokudb Shared Data", NULL, NULL, FALSE);
#endif
static struct st_mysql_sys_var *tokudb_system_variables[] = { static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(cache_size), MYSQL_SYSVAR(cache_size),
MYSQL_SYSVAR(max_lock_memory), MYSQL_SYSVAR(max_lock_memory),
...@@ -1464,16 +1447,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1464,16 +1447,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(read_status_frequency), MYSQL_SYSVAR(read_status_frequency),
MYSQL_SYSVAR(fs_reserve_percent), MYSQL_SYSVAR(fs_reserve_percent),
MYSQL_SYSVAR(tmp_dir), MYSQL_SYSVAR(tmp_dir),
#if 0 MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(cache_parts),
MYSQL_SYSVAR(env_flags),
MYSQL_SYSVAR(home),
MYSQL_SYSVAR(lock_scan_time),
MYSQL_SYSVAR(lock_type),
MYSQL_SYSVAR(log_buffer_size),
MYSQL_SYSVAR(region_size),
MYSQL_SYSVAR(shared_data),
#endif
NULL NULL
}; };
......
...@@ -17,6 +17,7 @@ uint get_pk_insert_mode(THD* thd); ...@@ -17,6 +17,7 @@ uint get_pk_insert_mode(THD* thd);
bool get_load_save_space(THD* thd); bool get_load_save_space(THD* thd);
bool get_create_index_online(THD* thd); bool get_create_index_online(THD* thd);
bool get_prelock_empty(THD* thd); bool get_prelock_empty(THD* thd);
uint get_tokudb_block_size(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