Make ReadRangeDelAggregator::ShouldDelete() more inline friendly (#5202)

Summary:
Reorganize the code so that no function call into ReadRangeDelAggregator is needed if there is no tomb range stone.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5202

Differential Revision: D14968155

Pulled By: siying

fbshipit-source-id: 0bd61911293c7a27b4e1b8d57c66d0c4ad6a6a5f
This commit is contained in:
Siying Dong 2019-04-18 12:22:29 -07:00 committed by Facebook Github Bot
parent 01cfea6637
commit d6862b3f51
2 changed files with 12 additions and 4 deletions

View file

@ -322,7 +322,7 @@ void ReadRangeDelAggregator::AddTombstones(
std::move(input_iter), icmp_, smallest, largest))); std::move(input_iter), icmp_, smallest, largest)));
} }
bool ReadRangeDelAggregator::ShouldDelete(const ParsedInternalKey& parsed, bool ReadRangeDelAggregator::ShouldDeleteImpl(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) { RangeDelPositioningMode mode) {
return rep_.ShouldDelete(parsed, mode); return rep_.ShouldDelete(parsed, mode);
} }

View file

@ -349,7 +349,7 @@ class RangeDelAggregator {
std::set<uint64_t> files_seen_; std::set<uint64_t> files_seen_;
}; };
class ReadRangeDelAggregator : public RangeDelAggregator { class ReadRangeDelAggregator final : public RangeDelAggregator {
public: public:
ReadRangeDelAggregator(const InternalKeyComparator* icmp, ReadRangeDelAggregator(const InternalKeyComparator* icmp,
SequenceNumber upper_bound) SequenceNumber upper_bound)
@ -364,7 +364,12 @@ class ReadRangeDelAggregator : public RangeDelAggregator {
const InternalKey* largest = nullptr) override; const InternalKey* largest = nullptr) override;
bool ShouldDelete(const ParsedInternalKey& parsed, bool ShouldDelete(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) override; RangeDelPositioningMode mode) final override {
if (rep_.IsEmpty()) {
return false;
}
return ShouldDeleteImpl(parsed, mode);
}
bool IsRangeOverlapped(const Slice& start, const Slice& end); bool IsRangeOverlapped(const Slice& start, const Slice& end);
@ -374,6 +379,9 @@ class ReadRangeDelAggregator : public RangeDelAggregator {
private: private:
StripeRep rep_; StripeRep rep_;
bool ShouldDeleteImpl(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode);
}; };
class CompactionRangeDelAggregator : public RangeDelAggregator { class CompactionRangeDelAggregator : public RangeDelAggregator {