diff --git a/db/compaction_iterator.cc b/db/compaction_iterator.cc index b6c8c4b73..fc7e56fae 100644 --- a/db/compaction_iterator.cc +++ b/db/compaction_iterator.cc @@ -98,8 +98,11 @@ void CompactionIterator::NextFromInput() { if (!ParseInternalKey(key_, &ikey_)) { // If `expect_valid_internal_key_` is false, return the corrupted key // and let the caller decide what to do with it. - // TODO(noetzli): Maybe we should have a more elegant solution for this. - assert(!expect_valid_internal_key_); + // TODO(noetzli): We should have a more elegant solution for this. + if (expect_valid_internal_key_) { + assert(!"corrupted internal key is not expected"); + break; + } current_user_key_.Clear(); has_current_user_key_ = false; current_user_key_sequence_ = kMaxSequenceNumber; diff --git a/db/compaction_iterator.h b/db/compaction_iterator.h index d683d5626..a92972256 100644 --- a/db/compaction_iterator.h +++ b/db/compaction_iterator.h @@ -90,7 +90,7 @@ class CompactionIterator { MergeHelper* merge_helper_; const std::vector* snapshots_; Env* env_; - bool expect_valid_internal_key_ __attribute__((__unused__)); + bool expect_valid_internal_key_; Statistics* stats_; Compaction* compaction_; const CompactionFilter* compaction_filter_;