mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-24 00:32:15 +00:00
comapction: use optional task info in major compaction
To make it consistent with the upcoming methods, methods triggering major compaction get std::optional<tasks::task_info> as an argument. Thanks to that we can distinguish between a task that has no parent and the task which won't be registered in task manager.
This commit is contained in:
@@ -526,12 +526,12 @@ future<compaction_manager::compaction_stats_opt> compaction_manager::perform_com
|
||||
co_return co_await perform_task(std::move(task_executor));
|
||||
}
|
||||
|
||||
future<> compaction_manager::perform_major_compaction(table_state& t, tasks::task_info info) {
|
||||
future<> compaction_manager::perform_major_compaction(table_state& t, std::optional<tasks::task_info> info) {
|
||||
if (_state != state::enabled) {
|
||||
co_return;
|
||||
}
|
||||
|
||||
co_await perform_compaction<major_compaction_task_executor>(info ? std::make_optional(info) : std::nullopt, &t, info.id).discard_result();
|
||||
co_await perform_compaction<major_compaction_task_executor>(info, &t, info.value_or(tasks::task_info{}).id).discard_result();
|
||||
}
|
||||
|
||||
namespace compaction {
|
||||
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
future<compaction_stats_opt> perform_sstable_scrub(compaction::table_state& t, sstables::compaction_type_options::scrub opts);
|
||||
|
||||
// Submit a table for major compaction.
|
||||
future<> perform_major_compaction(compaction::table_state& t, tasks::task_info info = {});
|
||||
future<> perform_major_compaction(compaction::table_state& t, std::optional<tasks::task_info> info = std::nullopt);
|
||||
|
||||
|
||||
// Run a custom job for a given table, defined by a function
|
||||
|
||||
@@ -857,7 +857,7 @@ public:
|
||||
// Start a compaction of all sstables in a process known as major compaction
|
||||
// Active memtable is flushed first to guarantee that data like tombstone,
|
||||
// sitting in the memtable, will be compacted with shadowed data.
|
||||
future<> compact_all_sstables(tasks::task_info info = {});
|
||||
future<> compact_all_sstables(std::optional<tasks::task_info> info = std::nullopt);
|
||||
|
||||
future<bool> snapshot_exists(sstring name);
|
||||
|
||||
|
||||
@@ -1225,7 +1225,7 @@ compaction_group::update_main_sstable_list_on_compaction_completion(sstables::co
|
||||
}
|
||||
|
||||
future<>
|
||||
table::compact_all_sstables(tasks::task_info info) {
|
||||
table::compact_all_sstables(std::optional<tasks::task_info> info) {
|
||||
co_await flush();
|
||||
co_await parallel_foreach_compaction_group([this, info] (compaction_group& cg) {
|
||||
return _compaction_manager.perform_major_compaction(cg.as_table_state(), info);
|
||||
|
||||
Reference in New Issue
Block a user