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

[t:3753], add basement node size param to handlerton

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@33051 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9c87f18a
......@@ -1872,7 +1872,6 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
int ha_tokudb::estimate_num_rows(DB* db, u_int64_t* num_rows, DB_TXN* txn) {
int error = ENOSYS;
DBC* crsr = NULL;
int is_exact;
bool do_commit = false;
DB_BTREE_STAT64 dict_stats;
DB_TXN* txn_to_use = NULL;
......@@ -5767,7 +5766,15 @@ int toku_dbt_up(DB*,
return 0;
}
static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN* txn, uint32_t block_size, bool is_hot_index) {
static int create_sub_table(
const char *table_name,
DBT* row_descriptor,
DB_TXN* txn,
uint32_t block_size,
uint32_t read_block_size,
bool is_hot_index
)
{
TOKUDB_DBUG_ENTER("create_sub_table");
int error;
DB *file = NULL;
......@@ -5789,6 +5796,13 @@ static int create_sub_table(const char *table_name, DBT* row_descriptor, DB_TXN*
goto exit;
}
}
if (read_block_size != 0) {
error = file->set_readpagesize(file, read_block_size);
if (error != 0) {
DBUG_PRINT("error", ("Got error: %d when setting read block size %u for table '%s'", error, read_block_size, table_name));
goto exit;
}
}
create_flags = DB_THREAD | DB_CREATE | DB_EXCL | (is_hot_index ? DB_IS_HOT_INDEX : 0);
error = file->open(file, txn, table_name, NULL, DB_BTREE, create_flags, my_umask);
......@@ -5976,6 +5990,8 @@ int ha_tokudb::create_secondary_dictionary(
u_int32_t max_row_desc_buff_size;
uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0;
uint32_t block_size;
uint32_t read_block_size;
THD* thd = ha_thd();
bzero(&row_descriptor, sizeof(row_descriptor));
......@@ -6013,11 +6029,11 @@ int ha_tokudb::create_secondary_dictionary(
block_size = key_info->block_size << 10;
if (block_size == 0) {
THD* thd = ha_thd();
block_size = get_tokudb_block_size(thd);
}
read_block_size = get_tokudb_read_block_size(thd);
error = create_sub_table(newname, &row_descriptor, txn, block_size, is_hot_index);
error = create_sub_table(newname, &row_descriptor, txn, block_size, read_block_size, is_hot_index);
cleanup:
my_free(newname, MYF(MY_ALLOW_ZERO_PTR));
my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR));
......@@ -6071,6 +6087,8 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
u_int32_t max_row_desc_buff_size;
uint hpk= (form->s->primary_key >= MAX_KEY) ? TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH : 0;
uint32_t block_size;
uint32_t read_block_size;
THD* thd = ha_thd();
bzero(&row_descriptor, sizeof(row_descriptor));
max_row_desc_buff_size = get_max_desc_size(kc_info, form);
......@@ -6106,12 +6124,12 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
if (prim_key)
block_size = prim_key->block_size << 10;
if (block_size == 0) {
THD* thd = ha_thd();
block_size = get_tokudb_block_size(thd);
}
read_block_size = get_tokudb_read_block_size(thd);
/* Create the main table that will hold the real rows */
error = create_sub_table(newname, &row_descriptor, txn, block_size, false);
error = create_sub_table(newname, &row_descriptor, txn, block_size, read_block_size, false);
cleanup:
my_free(newname, MYF(MY_ALLOW_ZERO_PTR));
my_free(row_desc_buff, MYF(MY_ALLOW_ZERO_PTR));
......
......@@ -128,6 +128,16 @@ static MYSQL_THDVAR_UINT(block_size,
~0L, // max
1 // blocksize???
);
static MYSQL_THDVAR_UINT(read_block_size,
0,
"fractal tree read block size",
NULL,
NULL,
128*1024, // default
4096, // min
~0L, // max
1 // blocksize???
);
void tokudb_checkpoint_lock(THD * thd);
void tokudb_checkpoint_unlock(THD * thd);
......@@ -595,6 +605,10 @@ 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);
}
typedef struct txn_progress_info {
char status[200];
THD* thd;
......@@ -1546,6 +1560,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(fs_reserve_percent),
MYSQL_SYSVAR(tmp_dir),
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(read_block_size),
NULL
};
......
......@@ -19,6 +19,7 @@ bool get_disable_slow_alter(THD* thd);
bool get_create_index_online(THD* thd);
bool get_prelock_empty(THD* thd);
uint get_tokudb_block_size(THD* thd);
uint get_tokudb_read_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