mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 12:36:56 +00:00
compaction_manager: prevent compaction from being postponed when stopping tasks
stop_tasks() must make sure that no ongoing task will postpone compaction when asked to stop. Therefore, let's set all tasks as stopping before any deferring point, such that no task will postpone compaction for a table which is being stopped. compaction_manager::remove() already handles this race with the same method, and given that remove() will later switch to stop_tasks(), let's do the same in stop_tasks(). Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>
This commit is contained in:
@@ -486,6 +486,11 @@ void compaction_manager::postpone_compaction_for_column_family(column_family* cf
|
||||
}
|
||||
|
||||
future<> compaction_manager::stop_tasks(std::vector<lw_shared_ptr<task>> tasks, sstring reason) {
|
||||
// To prevent compaction from being postponed while tasks are being stopped, let's set all
|
||||
// tasks as stopping before the deferring point below.
|
||||
for (auto& t : tasks) {
|
||||
t->stopping = true;
|
||||
}
|
||||
return do_with(std::move(tasks), [this, reason] (std::vector<lw_shared_ptr<task>>& tasks) {
|
||||
return parallel_for_each(tasks, [this, reason] (auto& task) {
|
||||
return this->task_stop(task, reason).then_wrapped([](future <> f) {
|
||||
|
||||
Reference in New Issue
Block a user