replica: table: pass do_flush to table::perform_cleanup_compaction()

this parameter defaults to do_flush::yes, so the existing behavior is
preserved. and this change prepares for a change which flushes all
tables before performing cleanup on the tables per-demand.

please note, we cannot pass compaction::flush_mode to this function,
as it is used by compaction/task_manager_module.hh, if we want to
share it by both database.hh and compaction/task_manager_module.hh,
we would have to find it a new home. so `table::do_flush` boolean
tag is reused instead.

Refs #16757

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
Kefu Chai
2024-01-30 12:14:38 +08:00
parent 9afec2e3e7
commit 34d80690fa
2 changed files with 9 additions and 4 deletions

View File

@@ -996,7 +996,9 @@ public:
// a future<bool> that is resolved when offstrategy_compaction completes.
// The future value is true iff offstrategy compaction was required.
future<bool> perform_offstrategy_compaction(std::optional<tasks::task_info> info = std::nullopt);
future<> perform_cleanup_compaction(owned_ranges_ptr sorted_owned_ranges, std::optional<tasks::task_info> info = std::nullopt);
future<> perform_cleanup_compaction(owned_ranges_ptr sorted_owned_ranges,
std::optional<tasks::task_info> info = std::nullopt,
do_flush = do_flush::yes);
unsigned estimate_pending_compactions() const;
void set_compaction_strategy(sstables::compaction_strategy_type strategy);

View File

@@ -1626,9 +1626,12 @@ future<bool> table::perform_offstrategy_compaction(std::optional<tasks::task_inf
co_return performed;
}
future<> table::perform_cleanup_compaction(compaction::owned_ranges_ptr sorted_owned_ranges, std::optional<tasks::task_info> info) {
co_await flush();
future<> table::perform_cleanup_compaction(compaction::owned_ranges_ptr sorted_owned_ranges,
std::optional<tasks::task_info> info,
do_flush do_flush) {
if (do_flush) {
co_await flush();
}
if (_compaction_groups.size() == 1) {
auto& cg = *get_compaction_group(0);
co_return co_await get_compaction_manager().perform_cleanup(std::move(sorted_owned_ranges), cg.as_table_state(), info);