This is an automated email from the ASF dual-hosted git repository.

edwardxu pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new 14abba473 fix: Unset change_level if 
level_compaction_dynamic_level_bytes is enabled (#3020)
14abba473 is described below

commit 14abba47382334cc91b6fac1c9625e6cb87b2051
Author: Yutian Li <[email protected]>
AuthorDate: Sat Jun 7 21:50:32 2025 -0400

    fix: Unset change_level if level_compaction_dynamic_level_bytes is enabled 
(#3020)
---
 src/storage/compaction_checker.cc | 4 +++-
 src/storage/storage.cc            | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/storage/compaction_checker.cc 
b/src/storage/compaction_checker.cc
index 34c621249..7f62f2032 100644
--- a/src/storage/compaction_checker.cc
+++ b/src/storage/compaction_checker.cc
@@ -27,7 +27,9 @@
 
 void CompactionChecker::CompactPropagateAndPubSubFiles() {
   rocksdb::CompactRangeOptions compact_opts;
-  compact_opts.change_level = true;
+  // See https://github.com/facebook/rocksdb/issues/13671
+  // change_level doesn't work well with level_compaction_dynamic_level_bytes
+  compact_opts.change_level = 
!storage_->GetConfig()->rocks_db.level_compaction_dynamic_level_bytes;
   for (const auto &cf :
        {engine::ColumnFamilyConfigs::PubSubColumnFamily(), 
engine::ColumnFamilyConfigs::PropagateColumnFamily()}) {
     info("[compaction checker] Start to compact the column family: {}", 
cf.Name());
diff --git a/src/storage/storage.cc b/src/storage/storage.cc
index b35c9aa03..8681eed87 100644
--- a/src/storage/storage.cc
+++ b/src/storage/storage.cc
@@ -876,7 +876,9 @@ rocksdb::ColumnFamilyHandle 
*Storage::GetCFHandle(ColumnFamilyID id) { return cf
 
 rocksdb::Status Storage::Compact(rocksdb::ColumnFamilyHandle *cf, const Slice 
*begin, const Slice *end) {
   rocksdb::CompactRangeOptions compact_opts;
-  compact_opts.change_level = true;
+  // See https://github.com/facebook/rocksdb/issues/13671
+  // change_level doesn't work well with level_compaction_dynamic_level_bytes
+  compact_opts.change_level = 
!config_->rocks_db.level_compaction_dynamic_level_bytes;
   // For the manual compaction, we would like to force the bottommost level to 
be compacted.
   // Or it may use the trivial mode and some expired key-values were still 
exist in the bottommost level.
   compact_opts.bottommost_level_compaction = 
rocksdb::BottommostLevelCompaction::kForceOptimized;

Reply via email to