Merge pull request #895 from zhipeng-jia/develop

Fix computation of size of last sub-compaction
main
Siying Dong 9 years ago
commit 4c5560d70a
  1. 4
      db/compaction_job.cc

@ -430,12 +430,12 @@ void CompactionJob::GenSubcompactionBoundaries() {
// sizes becomes >= the expected mean size of a subcompaction // sizes becomes >= the expected mean size of a subcompaction
sum = 0; sum = 0;
for (size_t i = 0; i < ranges.size() - 1; i++) { for (size_t i = 0; i < ranges.size() - 1; i++) {
sum += ranges[i].size;
if (subcompactions == 1) { if (subcompactions == 1) {
// If there's only one left to schedule then it goes to the end so no // If there's only one left to schedule then it goes to the end so no
// need to put an end boundary // need to put an end boundary
break; continue;
} }
sum += ranges[i].size;
if (sum >= mean) { if (sum >= mean) {
boundaries_.emplace_back(ExtractUserKey(ranges[i].range.limit)); boundaries_.emplace_back(ExtractUserKey(ranges[i].range.limit));
sizes_.emplace_back(sum); sizes_.emplace_back(sum);

Loading…
Cancel
Save