PragmaTwice commented on code in PR #2402:
URL: https://github.com/apache/kvrocks/pull/2402#discussion_r1694976867
##########
src/types/redis_hash.cc:
##########
@@ -418,4 +502,278 @@ rocksdb::Status Hash::RandField(const Slice &user_key,
int64_t command_count, st
return rocksdb::Status::OK();
}
+rocksdb::Status Hash::ExpireFields(const Slice &user_key, uint64_t expire_ms,
const std::vector<Slice> &fields,
+ HashFieldExpireType type,
std::vector<int8_t> *ret) {
+ std::string ns_key = AppendNamespacePrefix(user_key);
+ LockGuard guard(storage_->GetLockManager(), ns_key);
+ HashMetadata metadata(false);
+ LatestSnapShot ss(storage_);
+ rocksdb::Status s = GetMetadata(GetOptions{ss.GetSnapShot()}, ns_key,
&metadata);
+ if (!s.ok() && !s.IsNotFound()) return s;
+ if (s.IsNotFound()) {
+ ret->resize(fields.size(), -2);
+ return rocksdb::Status::OK();
+ }
+
+ // we don't support encode ttl on existing hash object
+ if (!metadata.IsFieldExpirationEnabled()) {
+ return rocksdb::Status::NotSupported("can't expire fields on existing hash
object");
Review Comment:
```suggestion
return rocksdb::Status::NotSupported("can't expire fields on hash object
whose field expiration feature is disabled");
```
What is "existing hash object"? IMHO it's a very vague message.
--
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]