From 98e59f9813f3cb6c6573c977d67eca77fd7708e2 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Sun, 16 Nov 2014 21:52:23 -0800 Subject: [PATCH] Fixed a bug which could hide non-ok status in CompactionJob::Run() Summary: Fixed a bug which could hide non-ok status in CompactionJob::Run() Test Plan: make Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D28995 --- db/compaction_job.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index bc514a2e8..d836ccd30 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -385,17 +385,22 @@ Status CompactionJob::Run() { compact_->MergeKeyValueSliceBuffer(&cfd->internal_comparator()); status = ProcessKeyValueCompaction(&imm_micros, input.get(), true); + if (!status.ok()) { + break; + } compact_->CleanupBatchBuffer(); compact_->CleanupMergedBuffer(); } } // done processing all prefix batches // finish the last batch - if (compact_->key_str_buf_.size() > 0) { - CallCompactionFilterV2(compaction_filter_v2); + if (status.ok()) { + if (compact_->key_str_buf_.size() > 0) { + CallCompactionFilterV2(compaction_filter_v2); + } + compact_->MergeKeyValueSliceBuffer(&cfd->internal_comparator()); + status = ProcessKeyValueCompaction(&imm_micros, input.get(), true); } - compact_->MergeKeyValueSliceBuffer(&cfd->internal_comparator()); - status = ProcessKeyValueCompaction(&imm_micros, input.get(), true); } // checking for compaction filter v2 if (status.ok() &&