From 0913e951678260a0ede3ef8256085336998aba67 Mon Sep 17 00:00:00 2001 From: Andi Date: Thu, 21 Mar 2024 10:12:28 +0100 Subject: [PATCH] Rename HA startup flags (#1820) --- src/coordination/coordinator_state.cpp | 6 +- .../include/coordination/raft_state.hpp | 4 +- src/coordination/raft_state.cpp | 14 ++-- src/flags/replication.cpp | 6 +- src/flags/replication.hpp | 6 +- src/memgraph.cpp | 2 +- src/query/interpreter.cpp | 32 ++++---- src/query/interpreter.hpp | 2 +- src/replication/state.cpp | 2 +- .../replication_handler.hpp | 2 +- src/storage/v2/config.hpp | 2 +- .../v2/replication/replication_client.cpp | 2 +- tests/drivers/run_cluster.sh | 18 ++-- tests/e2e/configuration/default_config.py | 6 +- .../coord_cluster_registration.py | 18 ++-- .../disable_writing_on_main_after_restart.py | 18 ++-- .../high_availability/distributed_coords.py | 82 +++++++++---------- .../manual_setting_replicas.py | 2 +- .../not_replicate_from_old_main.py | 14 ++-- .../high_availability/single_coordinator.py | 56 ++++++------- tests/e2e/high_availability/workloads.yaml | 8 +- 21 files changed, 151 insertions(+), 151 deletions(-) diff --git a/src/coordination/coordinator_state.cpp b/src/coordination/coordinator_state.cpp index 149a9cb97..0d6ce17c4 100644 --- a/src/coordination/coordinator_state.cpp +++ b/src/coordination/coordinator_state.cpp @@ -25,15 +25,15 @@ namespace memgraph::coordination { CoordinatorState::CoordinatorState() { - MG_ASSERT(!(FLAGS_raft_server_id && FLAGS_coordinator_server_port), + MG_ASSERT(!(FLAGS_coordinator_id && FLAGS_management_port), "Instance cannot be a coordinator and have registered coordinator server."); spdlog::info("Executing coordinator constructor"); - if (FLAGS_coordinator_server_port) { + if (FLAGS_management_port) { spdlog::info("Coordinator server port set"); auto const config = ManagementServerConfig{ .ip_address = kDefaultReplicationServerIp, - .port = static_cast(FLAGS_coordinator_server_port), + .port = static_cast(FLAGS_management_port), }; spdlog::info("Executing coordinator constructor main replica"); diff --git a/src/coordination/include/coordination/raft_state.hpp b/src/coordination/include/coordination/raft_state.hpp index 6e322ab78..c4958a5ba 100644 --- a/src/coordination/include/coordination/raft_state.hpp +++ b/src/coordination/include/coordination/raft_state.hpp @@ -40,7 +40,7 @@ using raft_result = nuraft::cmd_result>; class RaftState { private: - explicit RaftState(BecomeLeaderCb become_leader_cb, BecomeFollowerCb become_follower_cb, uint32_t raft_server_id, + explicit RaftState(BecomeLeaderCb become_leader_cb, BecomeFollowerCb become_follower_cb, uint32_t coordinator_id, uint32_t raft_port, std::string raft_address); auto InitRaftServer() -> void; @@ -84,7 +84,7 @@ class RaftState { private: // TODO: (andi) I think variables below can be abstracted/clean them. io::network::Endpoint raft_endpoint_; - uint32_t raft_server_id_; + uint32_t coordinator_id_; ptr state_machine_; ptr state_manager_; diff --git a/src/coordination/raft_state.cpp b/src/coordination/raft_state.cpp index 6175fda4b..3c1cbd158 100644 --- a/src/coordination/raft_state.cpp +++ b/src/coordination/raft_state.cpp @@ -31,12 +31,12 @@ using nuraft::raft_server; using nuraft::srv_config; using raft_result = cmd_result>; -RaftState::RaftState(BecomeLeaderCb become_leader_cb, BecomeFollowerCb become_follower_cb, uint32_t raft_server_id, +RaftState::RaftState(BecomeLeaderCb become_leader_cb, BecomeFollowerCb become_follower_cb, uint32_t coordinator_id, uint32_t raft_port, std::string raft_address) : raft_endpoint_(raft_address, raft_port), - raft_server_id_(raft_server_id), + coordinator_id_(coordinator_id), state_machine_(cs_new()), - state_manager_(cs_new(raft_server_id_, raft_endpoint_.SocketAddress())), + state_manager_(cs_new(coordinator_id_, raft_endpoint_.SocketAddress())), logger_(nullptr), become_leader_cb_(std::move(become_leader_cb)), become_follower_cb_(std::move(become_follower_cb)) {} @@ -95,11 +95,11 @@ auto RaftState::InitRaftServer() -> void { } auto RaftState::MakeRaftState(BecomeLeaderCb &&become_leader_cb, BecomeFollowerCb &&become_follower_cb) -> RaftState { - uint32_t raft_server_id = FLAGS_raft_server_id; - uint32_t raft_port = FLAGS_raft_server_port; + uint32_t coordinator_id = FLAGS_coordinator_id; + uint32_t raft_port = FLAGS_coordinator_port; auto raft_state = - RaftState(std::move(become_leader_cb), std::move(become_follower_cb), raft_server_id, raft_port, "127.0.0.1"); + RaftState(std::move(become_leader_cb), std::move(become_follower_cb), coordinator_id, raft_port, "127.0.0.1"); raft_state.InitRaftServer(); return raft_state; @@ -108,7 +108,7 @@ auto RaftState::MakeRaftState(BecomeLeaderCb &&become_leader_cb, BecomeFollowerC RaftState::~RaftState() { launcher_.shutdown(); } auto RaftState::InstanceName() const -> std::string { - return fmt::format("coordinator_{}", std::to_string(raft_server_id_)); + return fmt::format("coordinator_{}", std::to_string(coordinator_id_)); } auto RaftState::RaftSocketAddress() const -> std::string { return raft_endpoint_.SocketAddress(); } diff --git a/src/flags/replication.cpp b/src/flags/replication.cpp index e6b71b942..3f8fd2400 100644 --- a/src/flags/replication.cpp +++ b/src/flags/replication.cpp @@ -13,11 +13,11 @@ #ifdef MG_ENTERPRISE // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DEFINE_uint32(coordinator_server_port, 0, "Port on which coordinator servers will be started."); +DEFINE_uint32(management_port, 0, "Port on which coordinator servers will be started."); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DEFINE_uint32(raft_server_port, 0, "Port on which raft servers will be started."); +DEFINE_uint32(coordinator_port, 0, "Port on which raft servers will be started."); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DEFINE_uint32(raft_server_id, 0, "Unique ID of the raft server."); +DEFINE_uint32(coordinator_id, 0, "Unique ID of the raft server."); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DEFINE_uint32(instance_down_timeout_sec, 5, "Time duration after which an instance is considered down."); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) diff --git a/src/flags/replication.hpp b/src/flags/replication.hpp index 0a4982f12..e0d1aff8c 100644 --- a/src/flags/replication.hpp +++ b/src/flags/replication.hpp @@ -15,11 +15,11 @@ #ifdef MG_ENTERPRISE // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DECLARE_uint32(coordinator_server_port); +DECLARE_uint32(management_port); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DECLARE_uint32(raft_server_port); +DECLARE_uint32(coordinator_port); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) -DECLARE_uint32(raft_server_id); +DECLARE_uint32(coordinator_id); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) DECLARE_uint32(instance_down_timeout_sec); // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) diff --git a/src/memgraph.cpp b/src/memgraph.cpp index 9bf50131d..107cccb59 100644 --- a/src/memgraph.cpp +++ b/src/memgraph.cpp @@ -429,7 +429,7 @@ int main(int argc, char **argv) { #ifdef MG_ENTERPRISE // MAIN or REPLICA instance - if (FLAGS_coordinator_server_port) { + if (FLAGS_management_port) { memgraph::dbms::CoordinatorHandlers::Register(coordinator_state.GetCoordinatorServer(), replication_handler); MG_ASSERT(coordinator_state.GetCoordinatorServer().Start(), "Failed to start coordinator server!"); } diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp index 2fba0addb..87eccca87 100644 --- a/src/query/interpreter.cpp +++ b/src/query/interpreter.cpp @@ -474,7 +474,7 @@ class CoordQueryHandler final : public query::CoordinatorQueryHandler { } } - auto AddCoordinatorInstance(uint32_t raft_server_id, std::string_view bolt_server, + auto AddCoordinatorInstance(uint32_t coordinator_id, std::string_view bolt_server, std::string_view coordinator_server) -> void override { auto const maybe_coordinator_server = io::network::Endpoint::ParseSocketOrAddress(coordinator_server); if (!maybe_coordinator_server) { @@ -487,7 +487,7 @@ class CoordQueryHandler final : public query::CoordinatorQueryHandler { } auto const coord_coord_config = - coordination::CoordinatorToCoordinatorConfig{.coordinator_server_id = raft_server_id, + coordination::CoordinatorToCoordinatorConfig{.coordinator_server_id = coordinator_id, .bolt_server = *maybe_bolt_server, .coordinator_server = *maybe_coordinator_server}; @@ -942,10 +942,10 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters & switch (repl_query->action_) { case ReplicationQuery::Action::SET_REPLICATION_ROLE: { #ifdef MG_ENTERPRISE - if (FLAGS_raft_server_id) { + if (FLAGS_coordinator_id) { throw QueryRuntimeException("Coordinator can't set roles!"); } - if (FLAGS_coordinator_server_port) { + if (FLAGS_management_port) { throw QueryRuntimeException("Can't set role manually on instance with coordinator server port."); } #endif @@ -972,7 +972,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters & } case ReplicationQuery::Action::SHOW_REPLICATION_ROLE: { #ifdef MG_ENTERPRISE - if (FLAGS_raft_server_id) { + if (FLAGS_coordinator_id) { throw QueryRuntimeException("Coordinator doesn't have a replication role!"); } #endif @@ -993,7 +993,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters & } case ReplicationQuery::Action::REGISTER_REPLICA: { #ifdef MG_ENTERPRISE - if (FLAGS_coordinator_server_port) { + if (FLAGS_management_port) { throw QueryRuntimeException("Can't register replica manually on instance with coordinator server port."); } #endif @@ -1014,7 +1014,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters & case ReplicationQuery::Action::DROP_REPLICA: { #ifdef MG_ENTERPRISE - if (FLAGS_coordinator_server_port) { + if (FLAGS_management_port) { throw QueryRuntimeException("Can't drop replica manually on instance with coordinator server port."); } #endif @@ -1029,7 +1029,7 @@ Callback HandleReplicationQuery(ReplicationQuery *repl_query, const Parameters & } case ReplicationQuery::Action::SHOW_REPLICAS: { #ifdef MG_ENTERPRISE - if (FLAGS_raft_server_id) { + if (FLAGS_coordinator_id) { throw QueryRuntimeException("Coordinator cannot call SHOW REPLICAS! Use SHOW INSTANCES instead."); } #endif @@ -1176,7 +1176,7 @@ Callback HandleCoordinatorQuery(CoordinatorQuery *coordinator_query, const Param Callback callback; switch (coordinator_query->action_) { case CoordinatorQuery::Action::ADD_COORDINATOR_INSTANCE: { - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { throw QueryRuntimeException("Only coordinator can add coordinator instance!"); } @@ -1220,7 +1220,7 @@ Callback HandleCoordinatorQuery(CoordinatorQuery *coordinator_query, const Param return callback; } case CoordinatorQuery::Action::REGISTER_INSTANCE: { - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { throw QueryRuntimeException("Only coordinator can register coordinator server!"); } // TODO: MemoryResource for EvaluationContext, it should probably be passed as @@ -1273,7 +1273,7 @@ Callback HandleCoordinatorQuery(CoordinatorQuery *coordinator_query, const Param return callback; } case CoordinatorQuery::Action::UNREGISTER_INSTANCE: - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { throw QueryRuntimeException("Only coordinator can register coordinator server!"); } callback.fn = [handler = CoordQueryHandler{*coordinator_state}, @@ -1288,7 +1288,7 @@ Callback HandleCoordinatorQuery(CoordinatorQuery *coordinator_query, const Param return callback; case CoordinatorQuery::Action::SET_INSTANCE_TO_MAIN: { - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { throw QueryRuntimeException("Only coordinator can register coordinator server!"); } // TODO: MemoryResource for EvaluationContext, it should probably be passed as @@ -1305,7 +1305,7 @@ Callback HandleCoordinatorQuery(CoordinatorQuery *coordinator_query, const Param return callback; } case CoordinatorQuery::Action::SHOW_INSTANCES: { - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { throw QueryRuntimeException("Only coordinator can run SHOW INSTANCES."); } @@ -4281,7 +4281,7 @@ void Interpreter::RollbackTransaction() { #ifdef MG_ENTERPRISE auto Interpreter::Route(std::map const &routing) -> RouteResult { // TODO: (andi) Test - if (!FLAGS_raft_server_id) { + if (!FLAGS_coordinator_id) { auto const &address = routing.find("address"); if (address == routing.end()) { throw QueryException("Routing table must contain address field."); @@ -4417,7 +4417,7 @@ Interpreter::PrepareResult Interpreter::Prepare(const std::string &query_string, } #ifdef MG_ENTERPRISE - if (FLAGS_raft_server_id && !utils::Downcast(parsed_query.query) && + if (FLAGS_coordinator_id && !utils::Downcast(parsed_query.query) && !utils::Downcast(parsed_query.query)) { throw QueryRuntimeException("Coordinator can run only coordinator queries!"); } @@ -4548,7 +4548,7 @@ Interpreter::PrepareResult Interpreter::Prepare(const std::string &query_string, throw QueryException("Write query forbidden on the replica!"); } #ifdef MG_ENTERPRISE - if (FLAGS_coordinator_server_port && !interpreter_context_->repl_state->IsMainWriteable()) { + if (FLAGS_management_port && !interpreter_context_->repl_state->IsMainWriteable()) { query_execution = nullptr; throw QueryException( "Write query forbidden on the main! Coordinator needs to enable writing on main by sending RPC message."); diff --git a/src/query/interpreter.hpp b/src/query/interpreter.hpp index 5d10a24de..b6cb869a4 100644 --- a/src/query/interpreter.hpp +++ b/src/query/interpreter.hpp @@ -160,7 +160,7 @@ class CoordinatorQueryHandler { virtual std::vector ShowInstances() const = 0; /// @throw QueryRuntimeException if an error ocurred. - virtual auto AddCoordinatorInstance(uint32_t raft_server_id, std::string_view bolt_server, + virtual auto AddCoordinatorInstance(uint32_t coordinator_id, std::string_view bolt_server, std::string_view coordinator_server) -> void = 0; }; #endif diff --git a/src/replication/state.cpp b/src/replication/state.cpp index 1155fdb51..2e00670ec 100644 --- a/src/replication/state.cpp +++ b/src/replication/state.cpp @@ -56,7 +56,7 @@ ReplicationState::ReplicationState(std::optional durabili } auto replication_data = std::move(fetched_replication_data).GetValue(); #ifdef MG_ENTERPRISE - if (FLAGS_coordinator_server_port && std::holds_alternative(replication_data)) { + if (FLAGS_management_port && std::holds_alternative(replication_data)) { spdlog::trace("Restarted replication uuid for replica"); std::get(replication_data).uuid_.reset(); } diff --git a/src/replication_handler/include/replication_handler/replication_handler.hpp b/src/replication_handler/include/replication_handler/replication_handler.hpp index e1da19bfa..452ccce19 100644 --- a/src/replication_handler/include/replication_handler/replication_handler.hpp +++ b/src/replication_handler/include/replication_handler/replication_handler.hpp @@ -213,7 +213,7 @@ struct ReplicationHandler : public memgraph::query::ReplicationQueryHandler { // We force sync replicas in other situation if (state == storage::replication::ReplicaState::DIVERGED_FROM_MAIN) { #ifdef MG_ENTERPRISE - return FLAGS_coordinator_server_port != 0; + return FLAGS_management_port != 0; #else return false; #endif diff --git a/src/storage/v2/config.hpp b/src/storage/v2/config.hpp index 419f29b85..2d06ffe0d 100644 --- a/src/storage/v2/config.hpp +++ b/src/storage/v2/config.hpp @@ -132,7 +132,7 @@ struct Config { inline auto ReplicationStateRootPath(memgraph::storage::Config const &config) -> std::optional { if (!config.durability.restore_replication_state_on_startup #ifdef MG_ENTERPRISE - && !FLAGS_coordinator_server_port + && !FLAGS_management_port #endif ) { spdlog::warn( diff --git a/src/storage/v2/replication/replication_client.cpp b/src/storage/v2/replication/replication_client.cpp index ee1394fdb..008d4b619 100644 --- a/src/storage/v2/replication/replication_client.cpp +++ b/src/storage/v2/replication/replication_client.cpp @@ -92,7 +92,7 @@ void ReplicationStorageClient::UpdateReplicaState(Storage *storage, DatabaseAcce client_name, client_name, client_name); }; #ifdef MG_ENTERPRISE - if (!FLAGS_coordinator_server_port) { + if (!FLAGS_management_port) { log_error(); return; } diff --git a/tests/drivers/run_cluster.sh b/tests/drivers/run_cluster.sh index b5f75f2ef..6931c082b 100755 --- a/tests/drivers/run_cluster.sh +++ b/tests/drivers/run_cluster.sh @@ -35,7 +35,7 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/instance1.log \ --also-log-to-stderr \ - --coordinator-server-port=10011 \ + --management-port=10011 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_instance_1=$! @@ -51,7 +51,7 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/instance2.log \ --also-log-to-stderr \ - --coordinator-server-port=10012 \ + --management-port=10012 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_instance_2=$! @@ -67,7 +67,7 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/instance3.log \ --also-log-to-stderr \ - --coordinator-server-port=10013 \ + --management-port=10013 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_instance_3=$! @@ -84,8 +84,8 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/coordinator1.log \ --also-log-to-stderr \ - --raft-server-id=1 \ - --raft-server-port=10111 \ + --coordinator-id=1 \ + --coordinator-port=10111 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_coordinator_1=$! @@ -101,8 +101,8 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/coordinator2.log \ --also-log-to-stderr \ - --raft-server-id=2 \ - --raft-server-port=10112 \ + --coordinator-id=2 \ + --coordinator-port=10112 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_coordinator_2=$! @@ -118,8 +118,8 @@ $binary_dir/memgraph \ --bolt-cert-file="" \ --log-file=$tmpdir/logs/coordinator3.log \ --also-log-to-stderr \ - --raft-server-id=3 \ - --raft-server-port=10113 \ + --coordinator-id=3 \ + --coordinator-port=10113 \ --experimental-enabled=high-availability \ --log-level ERROR & pid_coordinator_3=$! diff --git a/tests/e2e/configuration/default_config.py b/tests/e2e/configuration/default_config.py index 11435da65..d2ba5c279 100644 --- a/tests/e2e/configuration/default_config.py +++ b/tests/e2e/configuration/default_config.py @@ -59,9 +59,9 @@ startup_config_dict = { "Time in seconds after which inactive Bolt sessions will be closed.", ), "cartesian_product_enabled": ("true", "true", "Enable cartesian product expansion."), - "coordinator_server_port": ("0", "0", "Port on which coordinator servers will be started."), - "raft_server_port": ("0", "0", "Port on which raft servers will be started."), - "raft_server_id": ("0", "0", "Unique ID of the raft server."), + "management_port": ("0", "0", "Port on which coordinator servers will be started."), + "coordinator_port": ("0", "0", "Port on which raft servers will be started."), + "coordinator_id": ("0", "0", "Unique ID of the raft server."), "instance_down_timeout_sec": ("5", "5", "Time duration after which an instance is considered down."), "instance_health_check_frequency_sec": ("1", "1", "The time duration between two health checks/pings."), "instance_get_uuid_frequency_sec": ("10", "10", "The time duration between two instance uuid checks."), diff --git a/tests/e2e/high_availability/coord_cluster_registration.py b/tests/e2e/high_availability/coord_cluster_registration.py index 89279b23d..16f91214d 100644 --- a/tests/e2e/high_availability/coord_cluster_registration.py +++ b/tests/e2e/high_availability/coord_cluster_registration.py @@ -36,7 +36,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -50,7 +50,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -64,7 +64,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -77,8 +77,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "setup_queries": [], @@ -89,8 +89,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "setup_queries": [], @@ -101,8 +101,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", ], "log_file": "coordinator3.log", "setup_queries": [], diff --git a/tests/e2e/high_availability/disable_writing_on_main_after_restart.py b/tests/e2e/high_availability/disable_writing_on_main_after_restart.py index e61eb4eb8..66264fe0d 100644 --- a/tests/e2e/high_availability/disable_writing_on_main_after_restart.py +++ b/tests/e2e/high_availability/disable_writing_on_main_after_restart.py @@ -36,7 +36,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--also-log-to-stderr", "--instance-health-check-frequency-sec", @@ -55,7 +55,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--also-log-to-stderr", "--instance-health-check-frequency-sec", @@ -74,7 +74,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--also-log-to-stderr", "--instance-health-check-frequency-sec", @@ -92,8 +92,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "setup_queries": [], @@ -104,8 +104,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "setup_queries": [], @@ -116,8 +116,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", "--also-log-to-stderr", ], "log_file": "coordinator3.log", diff --git a/tests/e2e/high_availability/distributed_coords.py b/tests/e2e/high_availability/distributed_coords.py index 59e083545..b863ca519 100644 --- a/tests/e2e/high_availability/distributed_coords.py +++ b/tests/e2e/high_availability/distributed_coords.py @@ -40,7 +40,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -54,7 +54,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -68,7 +68,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -81,8 +81,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "setup_queries": [], @@ -93,8 +93,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "setup_queries": [], @@ -105,8 +105,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", ], "log_file": "coordinator3.log", "setup_queries": [ @@ -130,7 +130,7 @@ def get_instances_description_no_setup(): "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -144,7 +144,7 @@ def get_instances_description_no_setup(): "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -158,7 +158,7 @@ def get_instances_description_no_setup(): "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -171,8 +171,8 @@ def get_instances_description_no_setup(): "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "data_directory": f"{TEMP_DIR}/coordinator_1", @@ -184,8 +184,8 @@ def get_instances_description_no_setup(): "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "data_directory": f"{TEMP_DIR}/coordinator_2", @@ -197,8 +197,8 @@ def get_instances_description_no_setup(): "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", ], "log_file": "coordinator3.log", "data_directory": f"{TEMP_DIR}/coordinator_3", @@ -640,7 +640,7 @@ def test_registering_4_coords(): "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -654,7 +654,7 @@ def test_registering_4_coords(): "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -668,7 +668,7 @@ def test_registering_4_coords(): "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -681,8 +681,8 @@ def test_registering_4_coords(): "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "setup_queries": [], @@ -693,8 +693,8 @@ def test_registering_4_coords(): "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "setup_queries": [], @@ -705,8 +705,8 @@ def test_registering_4_coords(): "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", ], "log_file": "coordinator3.log", "setup_queries": [], @@ -717,8 +717,8 @@ def test_registering_4_coords(): "--bolt-port", "7693", "--log-level=TRACE", - "--raft-server-id=4", - "--raft-server-port=10114", + "--coordinator-id=4", + "--coordinator-port=10114", ], "log_file": "coordinator4.log", "setup_queries": [ @@ -775,7 +775,7 @@ def test_registering_coord_log_store(): "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -789,7 +789,7 @@ def test_registering_coord_log_store(): "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -803,7 +803,7 @@ def test_registering_coord_log_store(): "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -816,8 +816,8 @@ def test_registering_coord_log_store(): "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator1.log", "setup_queries": [], @@ -828,8 +828,8 @@ def test_registering_coord_log_store(): "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=2", - "--raft-server-port=10112", + "--coordinator-id=2", + "--coordinator-port=10112", ], "log_file": "coordinator2.log", "setup_queries": [], @@ -840,8 +840,8 @@ def test_registering_coord_log_store(): "--bolt-port", "7692", "--log-level=TRACE", - "--raft-server-id=3", - "--raft-server-port=10113", + "--coordinator-id=3", + "--coordinator-port=10113", ], "log_file": "coordinator3.log", "setup_queries": [], @@ -852,8 +852,8 @@ def test_registering_coord_log_store(): "--bolt-port", "7693", "--log-level=TRACE", - "--raft-server-id=4", - "--raft-server-port=10114", + "--coordinator-id=4", + "--coordinator-port=10114", ], "log_file": "coordinator4.log", "setup_queries": [ @@ -911,7 +911,7 @@ def test_registering_coord_log_store(): bolt_port = f"--bolt-port={bolt_port_id}" - manag_server_port = f"--coordinator-server-port={manag_port_id}" + manag_server_port = f"--management-port={manag_port_id}" args_desc.append(bolt_port) args_desc.append(manag_server_port) diff --git a/tests/e2e/high_availability/manual_setting_replicas.py b/tests/e2e/high_availability/manual_setting_replicas.py index b0b0965bc..02d0ea4e9 100644 --- a/tests/e2e/high_availability/manual_setting_replicas.py +++ b/tests/e2e/high_availability/manual_setting_replicas.py @@ -31,7 +31,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "main.log", diff --git a/tests/e2e/high_availability/not_replicate_from_old_main.py b/tests/e2e/high_availability/not_replicate_from_old_main.py index d9729f650..3e328a544 100644 --- a/tests/e2e/high_availability/not_replicate_from_old_main.py +++ b/tests/e2e/high_availability/not_replicate_from_old_main.py @@ -153,7 +153,7 @@ def test_not_replicate_old_main_register_new_cluster(): "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", ], "log_file": "instance_1.log", @@ -167,7 +167,7 @@ def test_not_replicate_old_main_register_new_cluster(): "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", ], "log_file": "instance_2.log", @@ -180,8 +180,8 @@ def test_not_replicate_old_main_register_new_cluster(): "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ @@ -220,7 +220,7 @@ def test_not_replicate_old_main_register_new_cluster(): "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", ], "log_file": "instance_3.log", @@ -233,8 +233,8 @@ def test_not_replicate_old_main_register_new_cluster(): "--bolt-port", "7691", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10112", + "--coordinator-id=1", + "--coordinator-port=10112", ], "log_file": "coordinator.log", "setup_queries": [], diff --git a/tests/e2e/high_availability/single_coordinator.py b/tests/e2e/high_availability/single_coordinator.py index 1d839b4fc..6582ddfec 100644 --- a/tests/e2e/high_availability/single_coordinator.py +++ b/tests/e2e/high_availability/single_coordinator.py @@ -35,7 +35,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--replication-restore-state-on-startup=true", "--storage-recover-on-startup=false", @@ -52,7 +52,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--replication-restore-state-on-startup=true", "--storage-recover-on-startup=false", @@ -69,7 +69,7 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--replication-restore-state-on-startup=true", "--storage-recover-on-startup=false", @@ -85,8 +85,8 @@ MEMGRAPH_INSTANCES_DESCRIPTION = { "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ @@ -126,7 +126,7 @@ def test_replication_works_on_failover_replica_1_epoch_2_commits_away(data_recov "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--replication-restore-state-on-startup", "true", @@ -144,7 +144,7 @@ def test_replication_works_on_failover_replica_1_epoch_2_commits_away(data_recov "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--replication-restore-state-on-startup", "true", @@ -162,7 +162,7 @@ def test_replication_works_on_failover_replica_1_epoch_2_commits_away(data_recov "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--replication-restore-state-on-startup", "true", @@ -180,8 +180,8 @@ def test_replication_works_on_failover_replica_1_epoch_2_commits_away(data_recov "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ @@ -337,7 +337,7 @@ def test_replication_works_on_failover_replica_2_epochs_more_commits_away(data_r "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--replication-restore-state-on-startup", "true", @@ -355,7 +355,7 @@ def test_replication_works_on_failover_replica_2_epochs_more_commits_away(data_r "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--replication-restore-state-on-startup", "true", @@ -373,7 +373,7 @@ def test_replication_works_on_failover_replica_2_epochs_more_commits_away(data_r "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--replication-restore-state-on-startup", "true", @@ -392,7 +392,7 @@ def test_replication_works_on_failover_replica_2_epochs_more_commits_away(data_r "7691", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10014", "--replication-restore-state-on-startup", "true", @@ -410,8 +410,8 @@ def test_replication_works_on_failover_replica_2_epochs_more_commits_away(data_r "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ @@ -624,7 +624,7 @@ def test_replication_forcefully_works_on_failover_replica_misses_epoch(data_reco "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--replication-restore-state-on-startup", "true", @@ -642,7 +642,7 @@ def test_replication_forcefully_works_on_failover_replica_misses_epoch(data_reco "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--replication-restore-state-on-startup", "true", @@ -660,7 +660,7 @@ def test_replication_forcefully_works_on_failover_replica_misses_epoch(data_reco "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--replication-restore-state-on-startup", "true", @@ -679,7 +679,7 @@ def test_replication_forcefully_works_on_failover_replica_misses_epoch(data_reco "7691", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10014", "--replication-restore-state-on-startup", "true", @@ -697,8 +697,8 @@ def test_replication_forcefully_works_on_failover_replica_misses_epoch(data_reco "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ @@ -911,7 +911,7 @@ def test_replication_correct_replica_chosen_up_to_date_data(data_recovery): "7688", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10011", "--replication-restore-state-on-startup", "true", @@ -929,7 +929,7 @@ def test_replication_correct_replica_chosen_up_to_date_data(data_recovery): "7689", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10012", "--replication-restore-state-on-startup", "true", @@ -947,7 +947,7 @@ def test_replication_correct_replica_chosen_up_to_date_data(data_recovery): "7687", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10013", "--replication-restore-state-on-startup", "true", @@ -966,7 +966,7 @@ def test_replication_correct_replica_chosen_up_to_date_data(data_recovery): "7691", "--log-level", "TRACE", - "--coordinator-server-port", + "--management-port", "10014", "--replication-restore-state-on-startup", "true", @@ -984,8 +984,8 @@ def test_replication_correct_replica_chosen_up_to_date_data(data_recovery): "--bolt-port", "7690", "--log-level=TRACE", - "--raft-server-id=1", - "--raft-server-port=10111", + "--coordinator-id=1", + "--coordinator-port=10111", ], "log_file": "coordinator.log", "setup_queries": [ diff --git a/tests/e2e/high_availability/workloads.yaml b/tests/e2e/high_availability/workloads.yaml index aaf76fc6b..9d3bd3126 100644 --- a/tests/e2e/high_availability/workloads.yaml +++ b/tests/e2e/high_availability/workloads.yaml @@ -1,19 +1,19 @@ ha_cluster: &ha_cluster cluster: replica_1: - args: ["--experimental-enabled=high-availability", "--bolt-port", "7688", "--log-level=TRACE", "--coordinator-server-port=10011"] + args: ["--experimental-enabled=high-availability", "--bolt-port", "7688", "--log-level=TRACE", "--management-port=10011"] log_file: "replication-e2e-replica1.log" setup_queries: [] replica_2: - args: ["--experimental-enabled=high-availability", "--bolt-port", "7689", "--log-level=TRACE", "--coordinator-server-port=10012"] + args: ["--experimental-enabled=high-availability", "--bolt-port", "7689", "--log-level=TRACE", "--management-port=10012"] log_file: "replication-e2e-replica2.log" setup_queries: [] main: - args: ["--experimental-enabled=high-availability", "--bolt-port", "7687", "--log-level=TRACE", "--coordinator-server-port=10013"] + args: ["--experimental-enabled=high-availability", "--bolt-port", "7687", "--log-level=TRACE", "--management-port=10013"] log_file: "replication-e2e-main.log" setup_queries: [] coordinator: - args: ["--experimental-enabled=high-availability", "--bolt-port", "7690", "--log-level=TRACE", "--raft-server-id=1", "--raft-server-port=10111"] + args: ["--experimental-enabled=high-availability", "--bolt-port", "7690", "--log-level=TRACE", "--coordinator-id=1", "--coordinator-port=10111"] log_file: "replication-e2e-coordinator.log" setup_queries: [ "REGISTER INSTANCE instance_1 WITH CONFIG {'bolt_server': '127.0.0.1:7688', 'management_server': '127.0.0.1:10011', 'replication_server': '127.0.0.1:10001'};",