PragmaTwice commented on code in PR #1279:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1279#discussion_r1128105849


##########
src/commands/cmd_txn.cc:
##########
@@ -79,13 +91,37 @@ class CommandExec : public Commander {
       conn->ExecuteCommands(conn->GetMultiExecCommands());
       s = storage->CommitTxn();
     }
-    conn->ResetMultiExec();
     return s;
   }
 };
 
+class CommandWatch : public Commander {
+ public:
+  Status Execute(Server *svr, Connection *conn, std::string *output) override {
+    if (conn->IsFlagEnabled(Connection::kMultiExec)) {
+      *output = Redis::Error("ERR WATCH inside MULTI is not allowed");
+      return Status::OK();
+    }
+
+    svr->WatchKey(conn, std::vector<std::string>(args_.begin() + 1, 
args_.end()));
+    *output = Redis::SimpleString("OK");
+    return Status::OK();
+  }
+};
+
+class CommandUnwatch : public Commander {
+ public:
+  Status Execute(Server *svr, Connection *conn, std::string *output) override {

Review Comment:
   It seems weird to me that `unwatch` actually does not (instantly) fail in 
multi in Redis, e.g. in redis-cli
   ```
   MULTI
   WATCH  ... # error
   ...
   ```
   ```
   MULTI
   UNWATCH # ok
   ...
   ```



-- 
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