diff --git a/configure.py b/configure.py index 63fe026e78..b20550786a 100755 --- a/configure.py +++ b/configure.py @@ -1316,6 +1316,7 @@ idls = ['idl/gossip_digest.idl.hh', 'idl/utils.idl.hh', 'idl/gossip.idl.hh', 'idl/migration_manager.idl.hh', + "idl/node_ops.idl.hh", ] diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index d213f7ddc2..f98cbb6cf2 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -63,6 +63,7 @@ set(idl_headers utils.idl.hh gossip.idl.hh migration_manager.idl.hh + node_ops.idl.hh ) foreach(idl_header ${idl_headers}) diff --git a/idl/node_ops.idl.hh b/idl/node_ops.idl.hh new file mode 100644 index 0000000000..2768541437 --- /dev/null +++ b/idl/node_ops.idl.hh @@ -0,0 +1,52 @@ +/* + * Copyright 2024-present ScyllaDB + */ + +/* + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +#include "node_ops/id.hh" + +enum class node_ops_cmd : uint32_t { + removenode_prepare, + removenode_heartbeat, + removenode_sync_data, + removenode_abort, + removenode_done, + replace_prepare, + replace_prepare_mark_alive, + replace_prepare_pending_ranges, + replace_heartbeat, + replace_abort, + replace_done, + decommission_prepare, + decommission_heartbeat, + decommission_abort, + decommission_done, + bootstrap_prepare, + bootstrap_heartbeat, + bootstrap_abort, + bootstrap_done, + query_pending_ops, + repair_updater, +}; + +class node_ops_id final { + utils::UUID uuid(); +}; + +struct node_ops_cmd_request { + node_ops_cmd cmd; + node_ops_id ops_uuid; + std::list ignore_nodes; + std::list leaving_nodes; + std::unordered_map replace_nodes; + std::unordered_map> bootstrap_nodes; + std::list repair_tables; +}; + +struct node_ops_cmd_response { + bool ok; + std::list pending_ops; +}; diff --git a/idl/partition_checksum.idl.hh b/idl/partition_checksum.idl.hh index 2d6f23be53..c3436ad299 100644 --- a/idl/partition_checksum.idl.hh +++ b/idl/partition_checksum.idl.hh @@ -73,58 +73,6 @@ struct repair_row_level_start_response { repair_row_level_start_status status; }; -enum class node_ops_cmd : uint32_t { - removenode_prepare, - removenode_heartbeat, - removenode_sync_data, - removenode_abort, - removenode_done, - replace_prepare, - replace_prepare_mark_alive, - replace_prepare_pending_ranges, - replace_heartbeat, - replace_abort, - replace_done, - decommission_prepare, - decommission_heartbeat, - decommission_abort, - decommission_done, - bootstrap_prepare, - bootstrap_heartbeat, - bootstrap_abort, - bootstrap_done, - query_pending_ops, - repair_updater, -}; - -class node_ops_id final { - utils::UUID uuid(); -}; - -struct node_ops_cmd_request { - // Mandatory field, set by all cmds - node_ops_cmd cmd; - // Mandatory field, set by all cmds - node_ops_id ops_uuid; - // Optional field, list nodes to ignore, set by all cmds - std::list ignore_nodes; - // Optional field, list leaving nodes, set by decommission and removenode cmd - std::list leaving_nodes; - // Optional field, map existing nodes to replacing nodes, set by replace cmd - std::unordered_map replace_nodes; - // Optional field, map bootstrapping nodes to bootstrap tokens, set by bootstrap cmd - std::unordered_map> bootstrap_nodes; - // Optional field, list uuids of tables being repaired, set by repair cmd - std::list repair_tables; -}; - -struct node_ops_cmd_response { - // Mandatory field, set by all cmds - bool ok; - // Optional field, set by query_pending_ops cmd - std::list pending_ops; -}; - struct repair_update_system_table_request { tasks::task_id repair_uuid; table_id table_uuid; diff --git a/message/messaging_service.cc b/message/messaging_service.cc index 9c505ea3cf..7aa614b088 100644 --- a/message/messaging_service.cc +++ b/message/messaging_service.cc @@ -62,6 +62,7 @@ #include "idl/range.dist.hh" #include "idl/position_in_partition.dist.hh" #include "idl/partition_checksum.dist.hh" +#include "idl/node_ops.dist.hh" #include "idl/query.dist.hh" #include "idl/cache_temperature.dist.hh" #include "idl/view.dist.hh" @@ -116,6 +117,7 @@ #include "streaming/stream_manager.hh" #include "streaming/stream_mutation_fragments_cmd.hh" #include "idl/partition_checksum.dist.impl.hh" +#include "idl/node_ops.dist.impl.hh" #include "idl/mapreduce_request.dist.hh" #include "idl/mapreduce_request.dist.impl.hh" #include "idl/storage_service.dist.impl.hh"