Skip to content

Commit

Permalink
Replace manual RedisType check by calling IsSingleKVType (#2013)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Jan 14, 2024
1 parent 5cbc123 commit 7cbf0a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/storage/compact_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool SubKeyFilter::IsMetadataExpired(const InternalKey &ikey, const Metadata &me
// `util::GetTimeStampMS() - 300000` means extending 5 minutes for expired items,
// to prevent them from being recycled once they reach the expiration time.
uint64_t lazy_expired_ts = util::GetTimeStampMS() - 300000;
return metadata.Type() == kRedisString // metadata key was overwrite by set command
return metadata.IsSingleKVType() // metadata key was overwrite by set command
|| metadata.ExpireAt(lazy_expired_ts) || ikey.GetVersion() != metadata.version;
}

Expand Down
3 changes: 1 addition & 2 deletions src/storage/iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ std::unique_ptr<SubKeyIterator> DBIterator::GetSubKeyIterator() const {
return nullptr;
}

// The string/json type doesn't have sub keys
RedisType type = metadata_.Type();
if (type == kRedisNone || type == kRedisString || type == kRedisJson) {
if (type == kRedisNone || metadata_.IsSingleKVType()) {
return nullptr;
}

Expand Down

0 comments on commit 7cbf0a5

Please sign in to comment.