Fix RangeDeletion Snapshot bug

This commit is contained in:
奏之章 2019-11-21 15:18:06 +08:00 committed by ZhaoMing
parent a752fe311d
commit 1db81809d5

View File

@ -186,11 +186,14 @@ Status MemTableListVersion::AddRangeTombstoneIterators(
const ReadOptions& read_opts, Arena* /*arena*/, const ReadOptions& read_opts, Arena* /*arena*/,
RangeDelAggregator* range_del_agg) { RangeDelAggregator* range_del_agg) {
assert(range_del_agg != nullptr); assert(range_del_agg != nullptr);
SequenceNumber snapshot = kMaxSequenceNumber;
if (read_opts.snapshot != nullptr) {
snapshot = read_opts.snapshot->GetSequenceNumber();
}
for (auto& m : memlist_) { for (auto& m : memlist_) {
// Using kMaxSequenceNumber is OK because these are immutable memtables. // Using kMaxSequenceNumber is OK because these are immutable memtables.
std::unique_ptr<FragmentedRangeTombstoneIterator> range_del_iter( std::unique_ptr<FragmentedRangeTombstoneIterator> range_del_iter(
m->NewRangeTombstoneIterator(read_opts, m->NewRangeTombstoneIterator(read_opts, snapshot /* read_seq */));
kMaxSequenceNumber /* read_seq */));
range_del_agg->AddTombstones(std::move(range_del_iter)); range_del_agg->AddTombstones(std::move(range_del_iter));
} }
return Status::OK(); return Status::OK();