enjoy-binbin commented on code in PR #1935:
URL: https://github.com/apache/kvrocks/pull/1935#discussion_r1429383840
##########
src/types/redis_string.cc:
##########
@@ -187,20 +186,10 @@ rocksdb::Status String::GetEx(const std::string
&user_key, std::string *value, u
return rocksdb::Status::OK();
}
-rocksdb::Status String::GetSet(const std::string &user_key, const std::string
&new_value, std::string *old_value) {
- std::string ns_key = AppendNamespacePrefix(user_key);
-
- LockGuard guard(storage_->GetLockManager(), ns_key);
- rocksdb::Status s = getValue(ns_key, old_value);
- if (!s.ok() && !s.IsNotFound()) return s;
-
- std::string raw_value;
- Metadata metadata(kRedisString, false);
- metadata.Encode(&raw_value);
- raw_value.append(new_value);
- auto write_status = updateRawValue(ns_key, raw_value);
- // prev status was used to tell whether old value was empty or not
- return !write_status.ok() ? write_status : s;
+rocksdb::Status String::GetSet(const std::string &user_key, const std::string
&new_value,
+ std::optional<std::string> &old_value) {
+ auto s = Set(user_key, new_value, {/*ttl=*/0, StringSetType::NONE, /*get*/
true, /*keep_ttl*/ false}, old_value);
Review Comment:
```suggestion
auto s = Set(user_key, new_value, {/*ttl=*/0, StringSetType::NONE,
/*get=*/true, /*keep_ttl=*/false}, old_value);
```
--
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]