From 52c9808c3a5c31daf48f8b11b64a41d518916d8e Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Tue, 18 Oct 2016 16:30:34 -0700 Subject: [PATCH] not split file in compaciton on level 0 Summary: we should not split file on level 0 in compaction because it will fail the following verification of seqno order on level 0 Test Plan: check with filldeterministic in db_bench Reviewers: yhchiang, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D65193 --- db/compaction_job.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 22f376f90..d99ab5457 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -854,8 +854,9 @@ void CompactionJob::ProcessKeyValueCompaction(SubcompactionState* sub_compact) { // during subcompactions (i.e. if output size, estimated by input size, is // going to be 1.2MB and max_output_file_size = 1MB, prefer to have 0.6MB // and 0.6MB instead of 1MB and 0.2MB) - if (sub_compact->current_output_file_size >= - sub_compact->compaction->max_output_file_size()) { + if (sub_compact->compaction->output_level() != 0 && + sub_compact->current_output_file_size >= + sub_compact->compaction->max_output_file_size()) { const Slice* next_key = nullptr; if (c_iter->Valid()) { next_key = &c_iter->key();