PragmaTwice commented on code in PR #2323:
URL: https://github.com/apache/kvrocks/pull/2323#discussion_r1610198933


##########
src/commands/cmd_json.cc:
##########
@@ -624,6 +632,37 @@ class CommandJsonMSet : public Commander {
   }
 };
 
+class CommandJsonDebug : public Commander {
+ public:
+  Status Execute(Server *svr, Connection *conn, std::string *output) override {
+    redis::Json json(svr->storage, conn->GetNamespace());
+
+    std::string path = "$";
+
+    if (!util::EqualICase(args_[1], "memory")) {
+      return {Status::RedisExecErr, "ERR wrong number of arguments for 
'json.debug' command"};
+    }
+
+    if (args_.size() == 4) {
+      path = args_[3];
+    } else if (args_.size() > 4) {
+      return {Status::RedisExecErr, "The number of arguments is more than 
expected"};
+    }
+
+    std::vector<std::size_t> results;
+    auto s = json.DebugMemory(args_[2], path, &results);
+
+    if (s.IsNotFound()) {
+      *output = conn->NilString();

Review Comment:
   It's wrong. For nonexistent key, the result is `0`.
   
   Please confirm with redis-stack and redis-cli by yourself.



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