diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 25da68a4a1bae1f90900581e09c9bf8890cfa47a..d03994df004180cf253b2edbd658c889d0dbf849 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -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; @@ -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)); 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) { @@ -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)); diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index dff6899c50a401183d32740e709648b8bfbce152..51b31957d9658768671c777e5aa3ce5c24487786 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -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 }; diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h index 7c8676b66ac73ecb6611bfd4a20133c1d7200d01..4fb052550dca4718ee8a57806f43d831cd9b8d3d 100644 --- a/storage/tokudb/hatoku_hton.h +++ b/storage/tokudb/hatoku_hton.h @@ -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;