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*,
return 0;
}
static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* txn) {
static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* txn, uint32_t tokudb_block_size) {
TOKUDB_DBUG_ENTER("create_sub_table");
int error;
DB *file = NULL;
......@@ -5613,6 +5612,14 @@ static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN*
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);
if (error) {
DBUG_PRINT("error", ("Got error: %d when opening table '%s'", error, table_name));
......@@ -5730,7 +5737,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k
KEY* prim_key = NULL;
char dict_name[MAX_DICT_NAME_LEN];
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;
bzero(&row_descriptor, sizeof(row_descriptor));
......@@ -5790,7 +5797,7 @@ int ha_tokudb::create_secondary_dictionary(const char* name, TABLE* form, KEY* k
row_descriptor.size = ptr - row_desc_buff;
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:
my_free(newname, 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
char* newname = NULL;
KEY* prim_key = NULL;
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;
bzero(&row_descriptor, sizeof(row_descriptor));
......@@ -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);
/* 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:
my_free(newname, 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,
ULONGLONG_MAX, // max
1 // blocksize
);
static MYSQL_THDVAR_ULONGLONG(read_lock_wait,
0,
"time waiting for read lock",
......@@ -90,7 +89,6 @@ static MYSQL_THDVAR_UINT(pk_insert_mode,
2, // max
1 // blocksize
);
static MYSQL_THDVAR_BOOL(load_save_space,
0,
"if on, intial loads are slower but take less space",
......@@ -112,6 +110,16 @@ static MYSQL_THDVAR_BOOL(prelock_empty,
NULL,
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_unlock(THD * thd);
......@@ -559,6 +567,10 @@ bool get_prelock_empty(THD* thd) {
return (THDVAR(thd, prelock_empty) != 0);
}
uint get_tokudb_block_size(THD* thd) {
return THDVAR(thd, block_size);
}
typedef struct txn_progress_info {
char status[200];
THD* thd;
......@@ -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_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[] = {
MYSQL_SYSVAR(cache_size),
MYSQL_SYSVAR(max_lock_memory),
......@@ -1464,16 +1447,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(read_status_frequency),
MYSQL_SYSVAR(fs_reserve_percent),
MYSQL_SYSVAR(tmp_dir),
#if 0
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
MYSQL_SYSVAR(block_size),
NULL
};
......
......@@ -17,6 +17,7 @@ uint get_pk_insert_mode(THD* thd);
bool get_load_save_space(THD* thd);
bool get_create_index_online(THD* thd);
bool get_prelock_empty(THD* thd);
uint get_tokudb_block_size(THD* thd);
extern HASH tokudb_open_tables;
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