From fc84c69b7e6284a47a096cdf331d75c4ab97a893 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Tue, 31 May 2022 10:33:52 +0300 Subject: [PATCH] service: raft: add support for topology_change command into raft_group0_client Extend raft_group0_client::prepare_command with support of topology_change type of command. --- service/raft/raft_group0_client.cc | 7 ++++++- service/raft/raft_group0_client.hh | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/service/raft/raft_group0_client.cc b/service/raft/raft_group0_client.cc index 7c4bc25e8e..a7b36b58c6 100644 --- a/service/raft/raft_group0_client.cc +++ b/service/raft/raft_group0_client.cc @@ -283,7 +283,9 @@ future raft_group0_client::start_operation(seastar::abort_source* } } -group0_command raft_group0_client::prepare_command(schema_change change, group0_guard& guard, std::string_view description) { +template +requires std::same_as || std::same_as +group0_command raft_group0_client::prepare_command(Command change, group0_guard& guard, std::string_view description) { group0_command group0_cmd { .change{std::move(change)}, .history_append{db::system_keyspace::make_group0_history_state_id_mutation( @@ -411,4 +413,7 @@ void raft_group0_client::set_query_result(utils::UUID query_id, service::broadca } } +template group0_command raft_group0_client::prepare_command(schema_change change, group0_guard& guard, std::string_view description); +template group0_command raft_group0_client::prepare_command(topology_change change, group0_guard& guard, std::string_view description); + } diff --git a/service/raft/raft_group0_client.hh b/service/raft/raft_group0_client.hh index 08cfac71fb..c369635126 100644 --- a/service/raft/raft_group0_client.hh +++ b/service/raft/raft_group0_client.hh @@ -127,8 +127,10 @@ public: // and add_entry would again forward to shard 0. future start_operation(seastar::abort_source* as = nullptr); - group0_command prepare_command(schema_change change, group0_guard& guard, std::string_view description); group0_command prepare_command(broadcast_table_query query); + template + requires std::same_as || std::same_as + group0_command prepare_command(Command change, group0_guard& guard, std::string_view description); // Returns the current group 0 upgrade state. //