From 728f944f0d48cc2476cae799d39c2de7fe738d5a Mon Sep 17 00:00:00 2001 From: Zhipeng Jia Date: Tue, 22 Dec 2015 18:37:51 +0800 Subject: [PATCH] Fix computation of size of last sub-compaction --- db/compaction_job.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 5bcf4cd29..f014efb60 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -430,12 +430,12 @@ void CompactionJob::GenSubcompactionBoundaries() { // sizes becomes >= the expected mean size of a subcompaction sum = 0; for (size_t i = 0; i < ranges.size() - 1; i++) { + sum += ranges[i].size; if (subcompactions == 1) { // If there's only one left to schedule then it goes to the end so no // need to put an end boundary - break; + continue; } - sum += ranges[i].size; if (sum >= mean) { boundaries_.emplace_back(ExtractUserKey(ranges[i].range.limit)); sizes_.emplace_back(sum);