revision-id: 7dca0d62c8ec62904f611aea81d593e4a74b7d55 (fb-prod201801-223-g7dca0d62c8e) parent(s): 17d2b76267a967a5e8fbdf35330bc5ee25115cc6 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-04-22 13:21:35 +0300 message: MyRocks part of: Remove TransactionDB::get_range_lock_manager() --- rocksdb | 2 +- storage/rocksdb/ha_rocksdb.cc | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rocksdb b/rocksdb index 3b7567781e5..ded1df92d19 160000 --- a/rocksdb +++ b/rocksdb @@ -1 +1 @@ -Subproject commit 3b7567781e50b1ced3583a60fa7f1a568cc42d2e +Subproject commit ded1df92d1992b63f9db12e8757cb65ea711a4e3 diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 5974cc2d0a0..dea7fb9e53f 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -598,6 +598,7 @@ static uint32_t rocksdb_max_manual_compactions = 0; static ulong rocksdb_max_lock_memory; static my_bool rocksdb_use_range_locking = 0; +static std::shared_ptr<rocksdb::RangeLockMgrHandle> range_lock_mgr; std::atomic<uint64_t> rocksdb_row_lock_deadlocks(0); std::atomic<uint64_t> rocksdb_row_lock_wait_timeouts(0); @@ -4973,7 +4974,12 @@ static int rocksdb_init_func(void *const p) { tx_db_options.custom_mutex_factory = std::make_shared<Rdb_mutex_factory>(); tx_db_options.write_policy = static_cast<rocksdb::TxnDBWritePolicy>(rocksdb_write_policy); - tx_db_options.use_range_locking = rocksdb_use_range_locking; + + if (rocksdb_use_range_locking) { + range_lock_mgr.reset( + rocksdb::NewRangeLockManager(tx_db_options.custom_mutex_factory)); + tx_db_options.range_lock_mgr = range_lock_mgr; + } status = check_rocksdb_options_compatibility(rocksdb_datadir, main_opts, cf_descr); @@ -4996,11 +5002,9 @@ static int rocksdb_init_func(void *const p) { DBUG_RETURN(HA_EXIT_FAILURE); } - if (rocksdb_use_range_locking) + if (range_lock_mgr) { - rocksdb::RangeLockMgrControl *mgr= rdb->get_range_lock_manager(); - - mgr->set_max_lock_memory(rocksdb_max_lock_memory); + range_lock_mgr->set_max_lock_memory(rocksdb_max_lock_memory); sql_print_information("RocksDB: USING NEW RANGE LOCKING"); sql_print_information("RocksDB: Max lock memory=%lu", rocksdb_max_lock_memory); } @@ -12903,10 +12907,9 @@ static SHOW_VAR rocksdb_empty_status_variables[] = { static void show_rocksdb_locktree_vars(THD *thd, SHOW_VAR *var, char *buff) { var->type = SHOW_ARRAY; - if (rocksdb_use_range_locking) + if (range_lock_mgr) { - //TODO: - rocksdb_locktree_escalation_count= rdb->get_range_lock_manager()->get_escalation_count(); + rocksdb_locktree_escalation_count= range_lock_mgr->get_escalation_count(); var->value = reinterpret_cast<char *>(&rocksdb_locktree_status_variables); } else