From 48256285e0bcdd66fb867893b7ce27700d990525 Mon Sep 17 00:00:00 2001 From: PhaniShekhar Date: Mon, 18 Sep 2017 18:53:53 -0700 Subject: [PATCH] Use L1 size as estimated L0 size in GetPathID --- db/compaction_picker.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index c6a56746ff0..b1d099165cb 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -1279,6 +1279,8 @@ uint32_t LevelCompactionBuilder::GetPathId( uint64_t level_size; int cur_level = 0; + // max_bytes_for_level_base denotes L1 size. + // We estimate L0 size to be the same as L1. level_size = mutable_cf_options.max_bytes_for_level_base; // Last path is the fallback @@ -1289,8 +1291,10 @@ uint32_t LevelCompactionBuilder::GetPathId( return p; } else { current_path_size -= level_size; - level_size = static_cast( - level_size * mutable_cf_options.max_bytes_for_level_multiplier); + if (cur_level > 0) { + level_size = static_cast( + level_size * mutable_cf_options.max_bytes_for_level_multiplier); + } cur_level++; continue; }