From fc278be6c4edc028c7908d3c2d236b479032b3f8 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sun, 6 Nov 2022 12:37:35 +0200 Subject: [PATCH] table: add perform_cleanup_compaction Move the integration with compaction_manager from the api layer to the tabel class so it can also make sure the memtable is cleaned up in the next patch. Signed-off-by: Benny Halevy --- api/storage_service.cc | 2 +- replica/database.hh | 8 +++++++- replica/table.cc | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api/storage_service.cc b/api/storage_service.cc index 2e9295c224..269c9cad9c 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -660,7 +660,7 @@ void set_storage_service(http_context& ctx, routes& r, sharded that is resolved when offstrategy_compaction completes. // The future value is true iff offstrategy compaction was required. future perform_offstrategy_compaction(); + future<> perform_cleanup_compaction(owned_ranges_ptr sorted_owned_ranges); + void set_compaction_strategy(sstables::compaction_strategy_type strategy); const sstables::compaction_strategy& get_compaction_strategy() const { return _compaction_strategy; @@ -909,7 +911,11 @@ public: return _compaction_strategy; } - const compaction_manager& get_compaction_manager() const { + const compaction_manager& get_compaction_manager() const noexcept { + return _compaction_manager; + } + + compaction_manager& get_compaction_manager() noexcept { return _compaction_manager; } diff --git a/replica/table.cc b/replica/table.cc index e790bf1dfc..93c4d38330 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -1149,6 +1149,10 @@ future table::perform_offstrategy_compaction() { return _compaction_manager.perform_offstrategy(as_table_state()); } +future<> table::perform_cleanup_compaction(compaction::owned_ranges_ptr sorted_owned_ranges) { + co_await get_compaction_manager().perform_cleanup(std::move(sorted_owned_ranges), as_table_state()); +} + void table::set_compaction_strategy(sstables::compaction_strategy_type strategy) { tlogger.debug("Setting compaction strategy of {}.{} to {}", _schema->ks_name(), _schema->cf_name(), sstables::compaction_strategy::name(strategy)); auto new_cs = make_compaction_strategy(strategy, _schema->compaction_strategy_options());