Skip to content

Commit

Permalink
Squash this commit with the previous commit if it pass code review
Browse files Browse the repository at this point in the history
Two new system variables were added:

tokudb_enable_native_patition -
  enable native partitioning for TokuDB, read-only, default value is 'off',
rocksdb_enable_native_patition -
  enable native partitioning for RocksDB, read-only, default value is 'off'.
  • Loading branch information
vlad-lesin committed Sep 11, 2018
1 parent 757f5fe commit ac40861
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
14 changes: 12 additions & 2 deletions storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ static char *rocksdb_strict_collation_exceptions = nullptr;
static my_bool rocksdb_collect_sst_properties = TRUE;
static my_bool rocksdb_force_flush_memtable_now_var = FALSE;
static my_bool rocksdb_force_flush_memtable_and_lzero_now_var = FALSE;
static my_bool rocksdb_enable_native_partition = FALSE;
static my_bool rocksdb_enable_ttl = TRUE;
static my_bool rocksdb_enable_ttl_read_filtering = TRUE;
static int rocksdb_debug_ttl_rec_ts = 0;
Expand Down Expand Up @@ -1300,6 +1301,12 @@ static MYSQL_SYSVAR_BOOL(pause_background_work, rocksdb_pause_background_work,
"Disable all rocksdb background operations", nullptr,
rocksdb_set_pause_background_work, false);

static MYSQL_SYSVAR_BOOL(
enable_native_partition, rocksdb_enable_native_partition,
PLUGIN_VAR_READONLY,
"Enable native partitioning", nullptr,
nullptr, false);

static MYSQL_SYSVAR_BOOL(
enable_ttl, rocksdb_enable_ttl, PLUGIN_VAR_RQCMDARG,
"Enable expired TTL records to be dropped during compaction.", nullptr,
Expand Down Expand Up @@ -1630,6 +1637,7 @@ static struct st_mysql_sys_var *rocksdb_system_variables[] = {
MYSQL_SYSVAR(collect_sst_properties),
MYSQL_SYSVAR(force_flush_memtable_now),
MYSQL_SYSVAR(force_flush_memtable_and_lzero_now),
MYSQL_SYSVAR(enable_native_partition),
MYSQL_SYSVAR(enable_ttl),
MYSQL_SYSVAR(enable_ttl_read_filtering),
MYSQL_SYSVAR(debug_ttl_rec_ts),
Expand Down Expand Up @@ -3921,7 +3929,8 @@ static int rocksdb_init_func(void *const p) {
rocksdb_hton->flags = HTON_TEMPORARY_NOT_SUPPORTED |
HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;

rocksdb_hton->partition_flags = rocksdb_partition_flags;
if (rocksdb_enable_native_partition)
rocksdb_hton->partition_flags = rocksdb_partition_flags;

DBUG_ASSERT(!mysqld_embedded);

Expand Down Expand Up @@ -4774,7 +4783,8 @@ static handler *rocksdb_create_handler(my_core::handlerton *const hton,
my_core::TABLE_SHARE *const table_arg,
my_core::MEM_ROOT *const mem_root) {

if (table_arg && table_arg->db_type() == rocksdb_hton &&
if (rocksdb_enable_native_partition &&
table_arg && table_arg->db_type() == rocksdb_hton &&
table_arg->partition_info_str && table_arg->partition_info_str_len) {
ha_rockspart *file = new (mem_root) ha_rockspart(hton, table_arg);
if (file && file->init_partitioning(mem_root)) {
Expand Down
6 changes: 4 additions & 2 deletions storage/tokudb/hatoku_hton.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ static int tokudb_init_func(void *p) {
#endif

tokudb_hton->create = tokudb_create_handler;
tokudb_hton->partition_flags = tokudb_partition_flags;
if (tokudb::sysvars::enable_native_partition)
tokudb_hton->partition_flags = tokudb_partition_flags;
tokudb_hton->close_connection = tokudb_close_connection;
tokudb_hton->kill_connection = tokudb_kill_connection;

Expand Down Expand Up @@ -661,7 +662,8 @@ static int tokudb_done_func(TOKUDB_UNUSED(void* p)) {
static handler* tokudb_create_handler(handlerton* hton,
TABLE_SHARE* table,
MEM_ROOT* mem_root) {
if (table && table->db_type() == tokudb_hton && table->partition_info_str &&
if (tokudb::sysvars::enable_native_partition &&
table && table->db_type() == tokudb_hton && table->partition_info_str &&
table->partition_info_str_len) {
ha_tokupart* file = new (mem_root) ha_tokupart(hton, table);
if (file && file->init_partitioning(mem_root)) {
Expand Down
11 changes: 11 additions & 0 deletions storage/tokudb/tokudb_sysvars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ulong debug = 0;
my_bool debug_pause_background_job_manager = FALSE;
#endif // defined(TOKUDB_DEBUG) && TOKUDB_DEBUG
my_bool directio = FALSE;
my_bool enable_native_partition = FALSE;
my_bool enable_partial_eviction = TRUE;
// file system reserve as a percentage of total disk space
int fs_reserve_percent = 0;
Expand Down Expand Up @@ -263,6 +264,15 @@ static MYSQL_SYSVAR_BOOL(
NULL,
FALSE);

static MYSQL_SYSVAR_BOOL(
enable_native_partition,
enable_native_partition,
PLUGIN_VAR_READONLY,
"enable native partitioning",
NULL,
NULL,
FALSE);

static void enable_partial_eviction_update(
TOKUDB_UNUSED(THD* thd),
TOKUDB_UNUSED(st_mysql_sys_var* sys_var),
Expand Down Expand Up @@ -958,6 +968,7 @@ st_mysql_sys_var* system_variables[] = {
MYSQL_SYSVAR(data_dir),
MYSQL_SYSVAR(debug),
MYSQL_SYSVAR(directio),
MYSQL_SYSVAR(enable_native_partition),
MYSQL_SYSVAR(enable_partial_eviction),
MYSQL_SYSVAR(fs_reserve_percent),
MYSQL_SYSVAR(fsync_log_period),
Expand Down
1 change: 1 addition & 0 deletions storage/tokudb/tokudb_sysvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extern my_bool compress_buffers_before_eviction;
extern char* data_dir;
extern ulong debug;
extern my_bool directio;
extern my_bool enable_native_partition;
extern my_bool enable_partial_eviction;
extern int fs_reserve_percent;
extern uint fsync_log_period;
Expand Down

0 comments on commit ac40861

Please sign in to comment.