repair: add abort subscription to data sync task

When node operation is aborted, same should happen with
the corresponding task manager's repair task.

Subscribe data_sync_repair_task_impl abort() to node_ops_info
abort_source.
This commit is contained in:
Aleksandra Martyniuk
2022-10-31 16:33:26 +01:00
parent 2b35d7df1b
commit e48ca62390

View File

@@ -64,13 +64,20 @@ private:
dht::token_range_vector _ranges;
std::unordered_map<dht::token_range, repair_neighbors> _neighbors;
shared_ptr<node_ops_info> _ops_info;
optimized_optional<abort_source::subscription> _abort_subscription;
public:
data_sync_repair_task_impl(tasks::task_manager::module_ptr module, repair_uniq_id id, std::string keyspace, std::string entity, dht::token_range_vector ranges, std::unordered_map<dht::token_range, repair_neighbors> neighbors, streaming::stream_reason reason, shared_ptr<node_ops_info> ops_info)
: repair_task_impl(module, id.uuid(), id.id, std::move(keyspace), "", std::move(entity), tasks::task_id::create_null_id(), reason)
, _ranges(std::move(ranges))
, _neighbors(std::move(neighbors))
, _ops_info(ops_info)
{}
{
if (_ops_info && _ops_info->as) {
_abort_subscription = _ops_info->as->subscribe([this] () noexcept {
(void)abort();
});
}
}
protected:
future<> run() override;