From e48ca6239065248d958b01ebf29dfeff8153bb8b Mon Sep 17 00:00:00 2001 From: Aleksandra Martyniuk Date: Mon, 31 Oct 2022 16:33:26 +0100 Subject: [PATCH] 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. --- repair/repair_task.hh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repair/repair_task.hh b/repair/repair_task.hh index 07fe2cc12f..acd2036b4b 100644 --- a/repair/repair_task.hh +++ b/repair/repair_task.hh @@ -64,13 +64,20 @@ private: dht::token_range_vector _ranges; std::unordered_map _neighbors; shared_ptr _ops_info; + optimized_optional _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 neighbors, streaming::stream_reason reason, shared_ptr 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;