Replace GetUserKey with ExtractUserKey (#9664)

Summary:
Replace `GetUserKey` with `ExtractUserKey`

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9664

Reviewed By: jay-zhuang

Differential Revision: D34673571

Pulled By: ajkr

fbshipit-source-id: 5acf7d0d1a45efce0ccbe505991acf76c9cdc461
This commit is contained in:
ehds@qq.com 2022-03-15 10:02:33 -07:00 committed by Facebook GitHub Bot
parent 89429a9081
commit 60422f1676
3 changed files with 3 additions and 11 deletions

View File

@ -122,17 +122,13 @@ class PlainTableBuilder: public TableBuilder {
Slice GetPrefix(const Slice& target) const {
assert(target.size() >= 8); // target is internal key
return GetPrefixFromUserKey(GetUserKey(target));
return GetPrefixFromUserKey(ExtractUserKey(target));
}
Slice GetPrefix(const ParsedInternalKey& target) const {
return GetPrefixFromUserKey(target.user_key);
}
Slice GetUserKey(const Slice& key) const {
return Slice(key.data(), key.size() - 8);
}
Slice GetPrefixFromUserKey(const Slice& user_key) const {
if (!IsTotalOrderMode()) {
return prefix_extractor_->Transform(user_key);

View File

@ -563,7 +563,7 @@ Status PlainTableReader::Get(const ReadOptions& /*ro*/, const Slice& target,
Status::InvalidArgument("Get() is not allowed in full scan mode.");
}
// Match whole user key for bloom filter check.
if (!MatchBloom(GetSliceHash(GetUserKey(target)))) {
if (!MatchBloom(GetSliceHash(ExtractUserKey(target)))) {
return Status::OK();
}
// in total order mode, there is only one bucket 0, and we always use empty

View File

@ -179,17 +179,13 @@ class PlainTableReader: public TableReader {
Slice GetPrefix(const Slice& target) const {
assert(target.size() >= 8); // target is internal key
return GetPrefixFromUserKey(GetUserKey(target));
return GetPrefixFromUserKey(ExtractUserKey(target));
}
Slice GetPrefix(const ParsedInternalKey& target) const {
return GetPrefixFromUserKey(target.user_key);
}
Slice GetUserKey(const Slice& key) const {
return Slice(key.data(), key.size() - 8);
}
Slice GetPrefixFromUserKey(const Slice& user_key) const {
if (!IsTotalOrderMode()) {
return prefix_extractor_->Transform(user_key);