Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace manual RedisType check by calling IsSingleKVType #2013

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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