mapleFU commented on code in PR #2323:
URL: https://github.com/apache/kvrocks/pull/2323#discussion_r1606582596
##########
src/types/redis_json.cc:
##########
@@ -626,5 +626,17 @@ std::vector<rocksdb::Status> Json::readMulti(const
std::vector<Slice> &ns_keys,
}
return statuses;
}
+rocksdb::Status Json::DebugMemory(const std::string &user_key, const
std::string &path, Optionals<uint64_t> *results) {
Review Comment:
format or adding a space between them?
##########
src/commands/cmd_json.cc:
##########
@@ -624,6 +624,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, "The number of arguments is more than
expected"};
Review Comment:
why this is number more than expected?
##########
src/types/json.h:
##########
@@ -217,6 +217,25 @@ struct JsonValue {
return results;
}
+ StatusOr<Optionals<uint64_t>> StrBytes(std::string_view path) const {
+ Optionals<uint64_t> results;
+ try {
+ jsoncons::jsonpath::json_query(
+ value, path, [&results](const std::string & /*path*/, const
jsoncons::json &origin) {
+ if (!origin.empty()) {
+ // This is only a rough calculation of the size of the string
size char, not the entire byte occupied by
+ // the object
+ results.emplace_back(origin.as_string().size() *
sizeof(std::string::value_type));
Review Comment:
Could this json_query matches more than 1 element?
--
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]