From 576d2d6c60245a7b5846728310a666cfadd538fd Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Mon, 11 Feb 2019 14:56:50 -0800 Subject: [PATCH] WritePrepared: relax assert in compaction iterator (#4969) Summary: If IsInSnapshot(seq2, snapshot) determines that the snapshot is released, the future queries IsInSnapshot(seq1, snapshot) could still return a definitive answer of true if for example seq1 is too old that is determined visible in all snapshots. This violates a recently added assert statement to compaction iterator. The patch relaxes the assert. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4969 Differential Revision: D14030998 Pulled By: maysamyabandeh fbshipit-source-id: 6db53db0e37d0a20e8997ef2c1004b8627614ab9 --- db/compaction_iterator.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/compaction_iterator.cc b/db/compaction_iterator.cc index 9b136554ce..93c2b5fa9e 100644 --- a/db/compaction_iterator.cc +++ b/db/compaction_iterator.cc @@ -482,11 +482,14 @@ void CompactionIterator::NextFromInput() { // this value, and findEarliestVisibleSnapshot returns the next snapshot // as current_user_key_snapshot. In this case last value and current // value are both in current_user_key_snapshot currently. + // Although last_snapshot is released we might still get a definitive + // response when key sequence number changes, e.g., when seq is determined + // too old and visible in all snapshots. assert(last_snapshot == current_user_key_snapshot_ || (snapshot_checker_ != nullptr && snapshot_checker_->CheckInSnapshot(current_user_key_sequence_, - last_snapshot) == - SnapshotCheckerResult::kSnapshotReleased)); + last_snapshot) != + SnapshotCheckerResult::kNotInSnapshot)); ++iter_stats_.num_record_drop_hidden; // (A) input_->Next();