diff --git a/db/range_del_aggregator.cc b/db/range_del_aggregator.cc index 47599a18f..c175b9cee 100644 --- a/db/range_del_aggregator.cc +++ b/db/range_del_aggregator.cc @@ -82,12 +82,6 @@ bool TruncatedRangeDelIterator::Valid() const { icmp_->Compare(iter_->parsed_start_key(), *largest_) < 0); } -void TruncatedRangeDelIterator::Next() { iter_->TopNext(); } - -void TruncatedRangeDelIterator::Prev() { iter_->TopPrev(); } - -void TruncatedRangeDelIterator::InternalNext() { iter_->Next(); } - // NOTE: target is a user key void TruncatedRangeDelIterator::Seek(const Slice& target) { if (largest_ != nullptr && @@ -149,9 +143,8 @@ TruncatedRangeDelIterator::SplitBySnapshot( std::for_each( split_untruncated_iters.begin(), split_untruncated_iters.end(), [&](FragmentedIterPair& iter_pair) { - std::unique_ptr truncated_iter( - new TruncatedRangeDelIterator(std::move(iter_pair.second), icmp_, - smallest_ikey_, largest_ikey_)); + auto truncated_iter = std::make_unique( + std::move(iter_pair.second), icmp_, smallest_ikey_, largest_ikey_); split_truncated_iters.emplace(iter_pair.first, std::move(truncated_iter)); }); @@ -322,9 +315,8 @@ void ReadRangeDelAggregator::AddTombstones( if (input_iter == nullptr || input_iter->empty()) { return; } - rep_.AddTombstones( - std::unique_ptr(new TruncatedRangeDelIterator( - std::move(input_iter), icmp_, smallest, largest))); + rep_.AddTombstones(std::make_unique( + std::move(input_iter), icmp_, smallest, largest)); } bool ReadRangeDelAggregator::ShouldDeleteImpl(const ParsedInternalKey& parsed, @@ -471,19 +463,16 @@ CompactionRangeDelAggregator::NewIterator(const Slice* lower_bound, const Slice* upper_bound, bool upper_bound_inclusive) { InvalidateRangeDelMapPositions(); - std::unique_ptr merging_iter( - new TruncatedRangeDelMergingIter(icmp_, lower_bound, upper_bound, - upper_bound_inclusive, parent_iters_)); + auto merging_iter = std::make_unique( + icmp_, lower_bound, upper_bound, upper_bound_inclusive, parent_iters_); auto fragmented_tombstone_list = std::make_shared( std::move(merging_iter), *icmp_, true /* for_compaction */, *snapshots_); - return std::unique_ptr( - new FragmentedRangeTombstoneIterator( - fragmented_tombstone_list, *icmp_, - kMaxSequenceNumber /* upper_bound */)); + return std::make_unique( + fragmented_tombstone_list, *icmp_, kMaxSequenceNumber /* upper_bound */); } } // namespace ROCKSDB_NAMESPACE diff --git a/db/range_del_aggregator.h b/db/range_del_aggregator.h index 8bbee50fb..64f549590 100644 --- a/db/range_del_aggregator.h +++ b/db/range_del_aggregator.h @@ -38,10 +38,10 @@ class TruncatedRangeDelIterator { bool Valid() const; - void Next(); - void Prev(); + void Next() { iter_->TopNext(); } + void Prev() { iter_->TopPrev(); } - void InternalNext(); + void InternalNext() { iter_->Next(); } // Seeks to the tombstone with the highest visible sequence number that covers // target (a user key). If no such tombstone exists, the position will be at @@ -281,11 +281,11 @@ class RangeDelAggregator { const InternalKey* smallest = nullptr, const InternalKey* largest = nullptr) = 0; - bool ShouldDelete(const Slice& key, RangeDelPositioningMode mode) { + bool ShouldDelete(const Slice& ikey, RangeDelPositioningMode mode) { ParsedInternalKey parsed; Status pik_status = - ParseInternalKey(key, &parsed, false /* log_err_key */); // TODO + ParseInternalKey(ikey, &parsed, false /* log_err_key */); // TODO assert(pik_status.ok()); if (!pik_status.ok()) { return false; diff --git a/db/range_tombstone_fragmenter.cc b/db/range_tombstone_fragmenter.cc index 0985fee0b..8c90ff5b6 100644 --- a/db/range_tombstone_fragmenter.cc +++ b/db/range_tombstone_fragmenter.cc @@ -67,8 +67,8 @@ FragmentedRangeTombstoneList::FragmentedRangeTombstoneList( unfragmented_tombstones->value().size()); } // VectorIterator implicitly sorts by key during construction. - auto iter = std::unique_ptr( - new VectorIterator(std::move(keys), std::move(values), &icmp)); + auto iter = std::make_unique(std::move(keys), + std::move(values), &icmp); FragmentTombstones(std::move(iter), icmp, for_compaction, snapshots); } @@ -433,9 +433,8 @@ FragmentedRangeTombstoneIterator::SplitBySnapshot( upper = snapshots[i]; } if (tombstones_->ContainsRange(lower, upper)) { - splits.emplace(upper, std::unique_ptr( - new FragmentedRangeTombstoneIterator( - tombstones_, *icmp_, upper, lower))); + splits.emplace(upper, std::make_unique( + tombstones_, *icmp_, upper, lower)); } lower = upper + 1; }