torwig commented on code in PR #2819:
URL: https://github.com/apache/kvrocks/pull/2819#discussion_r1984639287


##########
src/commands/cmd_key.cc:
##########
@@ -336,6 +336,30 @@ class CommandPersist : public Commander {
   }
 };
 
+class CommandDelPrefix : public Commander {
+ public:
+  Status Execute(engine::Context &ctx, Server *srv, Connection *conn, 
std::string *output) override {
+    if (args_.size() != 2) {
+      return {Status::RedisParseErr, "wrong number of arguments for 
'DELPREFIX' command"};
+    }
+
+    std::string prefix = args_[1];
+    auto storage = srv->storage;
+    std::string start_key = prefix;
+    std::string end_key = prefix;
+    end_key.back()++;
+
+    rocksdb::WriteOptions write_options;
+    auto s = storage->GetDB()->DeleteRange(write_options, 
storage->GetCFHandle("data"), start_key, end_key);

Review Comment:
   Do we have a column family with the name "data"? 
   Additionally, I'm a little confused here since I see the function signature:
   `rocksdb::ColumnFamilyHandle *GetCFHandle(ColumnFamilyID id);`



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