[Commits] 293d69024: Range Locking : minor fixes

Sergei Petrunia psergey at askmonty.org
Mon Apr 29 18:11:02 EEST 2019


revision-id: 293d6902411748728fb48bf63e63ba121a963788 (v5.8-1039-g293d69024)
parent(s): d334cf12818bfd2d44dc06c7bbe78c3a18bca543
author: Sergei Petrunia
committer: Sergei Petrunia
timestamp: 2019-04-29 18:11:02 +0300
message:

Range Locking : minor fixes

- TransactionDB::init: Unused variable
- RangeLockList::append: always append the new range to the list (even if
  we've just created the transaction)
- PessimisticTransactionDB::TryRangeLock: safer value for currently-unused
  parameter

---
 utilities/transactions/pessimistic_transaction_db.cc | 2 +-
 utilities/transactions/transaction_lock_mgr.cc       | 4 +---
 utilities/transactions/transaction_lock_mgr.h        | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/utilities/transactions/pessimistic_transaction_db.cc b/utilities/transactions/pessimistic_transaction_db.cc
index e3ce435af..14b82de00 100644
--- a/utilities/transactions/pessimistic_transaction_db.cc
+++ b/utilities/transactions/pessimistic_transaction_db.cc
@@ -405,7 +405,7 @@ PessimisticTransactionDB::TryRangeLock(PessimisticTransaction *txn,
                                        const Endpoint& end_endp) {
   if (range_lock_mgr_) {
     return range_lock_mgr_->TryRangeLock(txn, cfh_id, start_endp,
-                                         end_endp, /*exclusive=*/false);
+                                         end_endp, /*exclusive=*/true);
   }
   else
     return Status::NotSupported();
diff --git a/utilities/transactions/transaction_lock_mgr.cc b/utilities/transactions/transaction_lock_mgr.cc
index c375b24f2..95e819b3a 100644
--- a/utilities/transactions/transaction_lock_mgr.cc
+++ b/utilities/transactions/transaction_lock_mgr.cc
@@ -798,12 +798,10 @@ public:
     auto it= buffers_.find(cf_id);
     if (it == buffers_.end()) {
       // create a new one
-      //it->second.create();
       it= buffers_.emplace(cf_id, std::shared_ptr<toku::range_buffer>(new toku::range_buffer())).first;
       it->second->create();
     }
-    else
-      it->second->append(left_key, right_key);
+    it->second->append(left_key, right_key);
   }
 
   std::unordered_map<uint32_t, std::shared_ptr<toku::range_buffer>> buffers_;
diff --git a/utilities/transactions/transaction_lock_mgr.h b/utilities/transactions/transaction_lock_mgr.h
index d35bf5935..1f5dbc634 100644
--- a/utilities/transactions/transaction_lock_mgr.h
+++ b/utilities/transactions/transaction_lock_mgr.h
@@ -78,7 +78,7 @@ class BaseLockMgr {
   virtual std::vector<DeadlockPath> GetDeadlockInfoBuffer()= 0;
 
   // TransactionDB will call this at start
-  virtual void init(TransactionDB *db_arg) {};
+  virtual void init(TransactionDB*) {};
   virtual ~BaseLockMgr(){}
 
   using LockStatusData = std::unordered_multimap<uint32_t, KeyLockInfo>;


More information about the commits mailing list