From 1a61ba179e9d8b55cdc27df5b03e184355901864 Mon Sep 17 00:00:00 2001 From: Jay Patel Date: Mon, 9 Oct 2017 22:53:00 -0700 Subject: [PATCH] compaction picker to use max_bytes_for_level_multiplier_additional Summary: Hi, As part of some optimization, we're using multiple DB locations (tmpfs and spindle) to store data and configured max_bytes_for_level_multiplier_additional. But, max_bytes_for_level_multiplier_additional is not used to compute the actual size for the level while picking the DB location. So, even if DB location does not have space, RocksDB mistakenly puts the level at that location. Can someone pls. verify the fix? Let me know any other changes required. Thanks, Jay Closes https://github.com/facebook/rocksdb/pull/2704 Differential Revision: D5992515 Pulled By: ajkr fbshipit-source-id: cbbc6c0e0a7dbdca91c72e0f37b218c4cec57e28 --- db/compaction_picker.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index 5971d0eae..21571e14f 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -1281,9 +1281,20 @@ uint32_t LevelCompactionBuilder::GetPathId( } else { current_path_size -= level_size; if (cur_level > 0) { - level_size = static_cast( + if (ioptions.level_compaction_dynamic_level_bytes) { + // Currently, level_compaction_dynamic_level_bytes is ignored when + // multiple db paths are specified. https://github.com/facebook/ + // rocksdb/blob/master/db/column_family.cc. + // Still, adding this check to avoid accidentally using + // max_bytes_for_level_multiplier_additional + level_size = static_cast( level_size * mutable_cf_options.max_bytes_for_level_multiplier); - } + } else { + level_size = static_cast( + level_size * mutable_cf_options.max_bytes_for_level_multiplier + * mutable_cf_options.MaxBytesMultiplerAdditional(cur_level)); + } + } cur_level++; continue; }