git-hulk commented on code in PR #577:
URL: https://github.com/apache/incubator-kvrocks/pull/577#discussion_r872996633


##########
src/lock_manager.cc:
##########
@@ -51,3 +51,7 @@ void LockManager::Lock(const rocksdb::Slice &key) {
 void LockManager::UnLock(const rocksdb::Slice &key) {
   mutex_pool_[hash(key)]->unlock();
 }
+
+void LockManager::LockTwo(const rocksdb::Slice &first_key, const 
rocksdb::Slice &second_key) {
+  std::lock(*mutex_pool_[hash(first_key)], *mutex_pool_[hash(second_key)]);

Review Comment:
   Aha, we are using `crc(key)%buckets` to calculate the hash value, so 
different keys can't promise the value always be different.
   
   >  Is it possible that more than 2 locks should be locked?
   
   To be honest, I'm not sure. What I think is that `MultiLocks` contains 2 
locks and more generic.
   
   > multi-version should deal with templates :)
   
   All is ok to me



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to