From 8a5341ec7dd9249cadd196b50e82fa3d23f414ad Mon Sep 17 00:00:00 2001 From: Xing Jin Date: Thu, 11 Jul 2013 09:03:40 -0700 Subject: [PATCH] Newbie code question Summary: This diff is more about my question when reading compaction codes, instead of a normal diff. I don't quite understand the logic here. Test Plan: I didn't do any test. If this is a bug, I will continue doing some test. Reviewers: haobo, dhruba, emayanke Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D11661 --- db/version_set.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index 9b01d935e..686e82cba 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1974,7 +1974,7 @@ Compaction* VersionSet::PickCompactionBySize(int level, double score) { assert(level >= 0); assert(level+1 < NumberLevels()); - c = new Compaction(level, MaxFileSizeForLevel(level), + c = new Compaction(level, MaxFileSizeForLevel(level+1), MaxGrandParentOverlapBytes(level), NumberLevels()); c->score_ = score; @@ -2072,7 +2072,7 @@ Compaction* VersionSet::PickCompaction() { if (level != 0 || compactions_in_progress_[0].empty()) { if(!ParentRangeInCompaction(&f->smallest, &f->largest, level, &parent_index)) { - c = new Compaction(level, MaxFileSizeForLevel(level), + c = new Compaction(level, MaxFileSizeForLevel(level+1), MaxGrandParentOverlapBytes(level), NumberLevels(), true); c->inputs_[0].push_back(f); c->parent_index_ = parent_index; @@ -2247,7 +2247,7 @@ Compaction* VersionSet::CompactRange( } } - Compaction* c = new Compaction(level, MaxFileSizeForLevel(level), + Compaction* c = new Compaction(level, MaxFileSizeForLevel(level+1), MaxGrandParentOverlapBytes(level), NumberLevels()); c->input_version_ = current_; c->input_version_->Ref();