From 1db81809d595a5afc4fa82b2d31bbc2d1b9a8923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=8F=E4=B9=8B=E7=AB=A0?= Date: Thu, 21 Nov 2019 15:18:06 +0800 Subject: [PATCH] Fix RangeDeletion Snapshot bug --- db/memtable_list.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/memtable_list.cc b/db/memtable_list.cc index d9159b793..4004fa79e 100644 --- a/db/memtable_list.cc +++ b/db/memtable_list.cc @@ -186,11 +186,14 @@ Status MemTableListVersion::AddRangeTombstoneIterators( const ReadOptions& read_opts, Arena* /*arena*/, RangeDelAggregator* range_del_agg) { assert(range_del_agg != nullptr); + SequenceNumber snapshot = kMaxSequenceNumber; + if (read_opts.snapshot != nullptr) { + snapshot = read_opts.snapshot->GetSequenceNumber(); + } for (auto& m : memlist_) { // Using kMaxSequenceNumber is OK because these are immutable memtables. std::unique_ptr range_del_iter( - m->NewRangeTombstoneIterator(read_opts, - kMaxSequenceNumber /* read_seq */)); + m->NewRangeTombstoneIterator(read_opts, snapshot /* read_seq */)); range_del_agg->AddTombstones(std::move(range_del_iter)); } return Status::OK();