diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 601a3e144817..c6b060c66222 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -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; @@ -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, @@ -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), @@ -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); @@ -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)) { diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index 74d5512b7c53..21891d4989ae 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -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; @@ -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)) { diff --git a/storage/tokudb/tokudb_sysvars.cc b/storage/tokudb/tokudb_sysvars.cc index 0118137419c1..426035b8bfff 100644 --- a/storage/tokudb/tokudb_sysvars.cc +++ b/storage/tokudb/tokudb_sysvars.cc @@ -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; @@ -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), @@ -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), diff --git a/storage/tokudb/tokudb_sysvars.h b/storage/tokudb/tokudb_sysvars.h index b702cf7daa95..63ca4e7a0c0f 100644 --- a/storage/tokudb/tokudb_sysvars.h +++ b/storage/tokudb/tokudb_sysvars.h @@ -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;