PragmaTwice commented on code in PR #2402:
URL: https://github.com/apache/kvrocks/pull/2402#discussion_r1696911547
##########
src/storage/redis_db.cc:
##########
@@ -558,10 +611,24 @@ rocksdb::Status SubKeyScanner::Scan(RedisType type, const
Slice &user_key, const
uint64_t cnt = 0;
std::string ns_key = AppendNamespacePrefix(user_key);
Metadata metadata(type, false);
+ std::string raw_value;
+ Slice rest;
LatestSnapShot ss(storage_);
- rocksdb::Status s = GetMetadata(GetOptions{ss.GetSnapShot()}, {type},
ns_key, &metadata);
+ rocksdb::Status s = GetMetadata(GetOptions{ss.GetSnapShot()}, {type},
ns_key, &raw_value, &metadata, &rest);
if (!s.ok()) return s;
+ // for hash type, we should filter expired field if encoding is with_ttl
+ bool is_encoding_field_ttl = false;
+ if (metadata.Type() == kRedisHash && !rest.empty()) {
+ uint8_t field_encoding = 0;
+ if (!GetFixed8(&rest, &field_encoding)) {
+ return rocksdb::Status::InvalidArgument();
+ }
+ if (field_encoding == 1) {
Review Comment:
Please use `HashSubkeyType` instead of hard-coding (`1`) 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]