[Commits] a8f74c978: Don't attempt to free RangeLockMgr::cmp_ if it hasnt been initialized
revision-id: a8f74c978795a37a5651b427eef0c8ef52220496 (v5.8-1031-ga8f74c978) parent(s): 3ce77681b7cc369e2f5c2a1f83216eb62776065d author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2019-01-28 23:02:33 +0300 message: Don't attempt to free RangeLockMgr::cmp_ if it hasnt been initialized (This happens if we don't use Range Locking. TODO: probably we should not create RangeLockMgr at all in this case) --- utilities/transactions/transaction_lock_mgr.cc | 5 ++++- utilities/transactions/transaction_lock_mgr.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/utilities/transactions/transaction_lock_mgr.cc b/utilities/transactions/transaction_lock_mgr.cc index 4c1417630..56f3295fd 100644 --- a/utilities/transactions/transaction_lock_mgr.cc +++ b/utilities/transactions/transaction_lock_mgr.cc @@ -1007,6 +1007,7 @@ int RangeLockMgr::compare_dbt_endpoints(__toku_db*, void *arg, RangeLockMgr::RangeLockMgr(TransactionDB* txn_db) : my_txn_db(txn_db) { ltm.create(on_create, on_destroy, on_escalate, NULL); lt= nullptr; + cmp_initialized_= false; } @@ -1058,6 +1059,7 @@ RangeLockMgr::set_endpoint_cmp_functions(convert_key_to_endpoint_func cvt_func, assert(!lt); cmp_.create(compare_dbt_endpoints, (void*)this, NULL); + cmp_initialized_ = true; DICTIONARY_ID dict_id = { .dictid = 1 }; lt= ltm.get_lt(dict_id, cmp_, /* on_create_extra*/nullptr); } @@ -1067,7 +1069,8 @@ RangeLockMgr::~RangeLockMgr() { ltm.release_lt(lt); } ltm.destroy(); - cmp_.destroy(); + if (cmp_initialized_) + cmp_.destroy(); } uint64_t RangeLockMgr::get_escalation_count() { diff --git a/utilities/transactions/transaction_lock_mgr.h b/utilities/transactions/transaction_lock_mgr.h index 31503c1e4..0c3284519 100644 --- a/utilities/transactions/transaction_lock_mgr.h +++ b/utilities/transactions/transaction_lock_mgr.h @@ -240,6 +240,7 @@ class RangeLockMgr : toku::locktree *lt; // only one tree for now toku::comparator cmp_; + bool cmp_initialized_; // Convert rowkey to endpoint (TODO: shouldn't "rowkey=const" translate into // a pair of [start; end] endpoints in general? They translate into the same
participants (1)
-
Sergei Petrunia