PragmaTwice commented on code in PR #2238:
URL: https://github.com/apache/kvrocks/pull/2238#discussion_r1562284630
##########
src/commands/cmd_key.cc:
##########
@@ -346,14 +345,13 @@ class CommandRename : public Commander {
public:
Status Execute(Server *srv, Connection *conn, std::string *output) override {
redis::Database redis(srv->storage, conn->GetNamespace());
- bool ret = true;
- bool key_exist = true;
+ Database::CopyResult res = Database::CopyResult::DONE;
std::string ns_key = redis.AppendNamespacePrefix(args_[1]);
std::string new_ns_key = redis.AppendNamespacePrefix(args_[2]);
- auto s = redis.Move(ns_key, new_ns_key, false, &ret, &key_exist);
+ auto s = redis.Copy(ns_key, new_ns_key, false, true, &res);
if (!s.ok()) return {Status::RedisExecErr, s.ToString()};
- if (!key_exist) return {Status::RedisExecErr,
rocksdb::Status::InvalidArgument("ERR no such key").ToString()};
-
+ if (res == Database::CopyResult::KEY_NOT_EXIST)
+ return {Status::RedisExecErr, rocksdb::Status::InvalidArgument("ERR no
such key").ToString()};
Review Comment:
```suggestion
return {Status::RedisExecErr, "no such key"};
```
rocksdb::Status is meaningless here..
--
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]