You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/05/16 08:14:53 UTC

[GitHub] [incubator-kvrocks] ShooterIT commented on a diff in pull request #577: Add LMove command

ShooterIT commented on code in PR #577:
URL: https://github.com/apache/incubator-kvrocks/pull/577#discussion_r873437597


##########
src/lock_manager.h:
##########
@@ -55,3 +58,25 @@ class LockGuard {
   LockManager *lock_mgr_ = nullptr;
   rocksdb::Slice key_;
 };
+
+class MultiLockGuard {
+ public:
+  explicit MultiLockGuard(LockManager *lock_mgr, const std::vector<std::string> &keys):
+      lock_mgr_(lock_mgr) {
+    locks_ = lock_mgr_->MultiGet(keys);
+    for (const auto &iter : locks_) {
+      iter->lock();
+    }
+  }
+
+  ~MultiLockGuard() {
+    // Lock with order `A B C` and unlock should be `C B A`

Review Comment:
   why we need to unlock reversely, AFAIK, they are separate.



##########
Changelog:
##########
@@ -1,5 +1,8 @@
 # Version 999.999.999
 
+New features
+  - Add LMove command
+

Review Comment:
   ```suggestion
   ```
   you don't need to modify this file, i will do this when we release new version.



-- 
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: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org