From d3f9ec537f38d4c4f40af98aeaadcf7f67414c22 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Wed, 25 Sep 2024 22:50:07 -0700 Subject: [PATCH] Add `is_bottommost_level` in compaction filter context (#374) Signed-off-by: Yang Zhang --- db/compaction/compaction.cc | 1 + include/rocksdb/compaction_filter.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/db/compaction/compaction.cc b/db/compaction/compaction.cc index bbab8f79fb5..ab7e7eaedfc 100644 --- a/db/compaction/compaction.cc +++ b/db/compaction/compaction.cc @@ -827,6 +827,7 @@ std::unique_ptr Compaction::CreateCompactionFilter() const { context.is_full_compaction = is_full_compaction_; context.is_manual_compaction = is_manual_compaction_; context.input_start_level = start_level_; + context.is_bottommost_level = bottommost_level_; context.column_family_id = cfd_->GetID(); context.reason = TableFileCreationReason::kCompaction; context.input_table_properties = GetInputTableProperties(); diff --git a/include/rocksdb/compaction_filter.h b/include/rocksdb/compaction_filter.h index 1784f2329ac..410ee4d3ab0 100644 --- a/include/rocksdb/compaction_filter.h +++ b/include/rocksdb/compaction_filter.h @@ -164,6 +164,8 @@ class CompactionFilter : public Customizable { // The lowest level among all the input files (if any) used in table // creation int input_start_level = kUnknownStartLevel; + // Whether output files are in bottommost level or not. + bool is_bottommost_level; // The column family that will contain the created table file. uint32_t column_family_id; // Reason this table file is being created.