From e674275fab89e22d01b7f21e6c0fbbe58f152c4c Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Sat, 27 Jul 2024 00:59:16 +0800 Subject: [PATCH] 2 --- src/meta/test/balancer_validator.cpp | 32 +++--- .../test/meta_partition_guardian_test.cpp | 102 +++++++++--------- src/meta/test/misc/misc.cpp | 76 ++++++------- src/meta/test/update_configuration_test.cpp | 22 ++-- src/replica/replica_config.cpp | 40 +++---- .../storage/simple_kv/test/checker.cpp | 18 ++-- src/replica/storage/simple_kv/test/client.cpp | 4 +- src/replica/test/open_replica_test.cpp | 2 +- src/runtime/test/host_port_test.cpp | 12 +-- src/shell/commands/recovery.cpp | 12 +-- 10 files changed, 160 insertions(+), 160 deletions(-) diff --git a/src/meta/test/balancer_validator.cpp b/src/meta/test/balancer_validator.cpp index 3671a90bd3..c6ce80b2f6 100644 --- a/src/meta/test/balancer_validator.cpp +++ b/src/meta/test/balancer_validator.cpp @@ -72,24 +72,24 @@ static void check_cure(app_mapper &apps, node_mapper &nodes, ::dsn::partition_co CHECK(!pc.hp_primary, ""); CHECK(pc.secondaries.empty(), ""); CHECK(pc.hp_secondaries.empty(), ""); - CHECK_EQ(act.node, act.target); - CHECK_EQ(act.hp_node, act.hp_target); - const auto node = nodes.find(act.hp_node); + CHECK_EQ(act.node1, act.target1); + CHECK_EQ(act.hp_node1, act.hp_target1); + const auto node = nodes.find(act.hp_node1); CHECK(node != nodes.end(), ""); ns = &node->second; CHECK_EQ(ns->served_as(pc.pid), partition_status::PS_INACTIVE); ns->put_partition(pc.pid, true); - SET_OBJ_IP_AND_HOST_PORT(pc, primary, act, node); + SET_OBJ_IP_AND_HOST_PORT(pc, primary, act, node1); break; } case config_type::CT_ADD_SECONDARY: { - CHECK(!is_member(pc, act.node), ""); - CHECK(!is_member(pc, act.hp_node), ""); - CHECK_EQ(pc.primary, act.target); - CHECK_EQ(pc.hp_primary, act.hp_target); - const auto node = nodes.find(act.hp_node); + CHECK(!is_member(pc, act.node1), ""); + CHECK(!is_member(pc, act.hp_node1), ""); + CHECK_EQ(pc.primary, act.target1); + CHECK_EQ(pc.hp_primary, act.hp_target1); + const auto node = nodes.find(act.hp_node1); CHECK(node != nodes.end(), ""); - ADD_IP_AND_HOST_PORT(pc, secondaries, act.node, act.hp_node); + ADD_IP_AND_HOST_PORT(pc, secondaries, act.node1, act.hp_node1); ns = &node->second; CHECK_EQ(ns->served_as(pc.pid), partition_status::PS_INACTIVE); ns->put_partition(pc.pid, false); @@ -110,14 +110,14 @@ static void check_cure(app_mapper &apps, node_mapper &nodes, ::dsn::partition_co CHECK_EQ(act.type, config_type::CT_UPGRADE_TO_PRIMARY); CHECK(!pc.primary, ""); CHECK(!pc.hp_primary, ""); - CHECK_EQ(act.node, act.target); - CHECK_EQ(act.hp_node, act.hp_target); - CHECK(is_secondary(pc, act.node), ""); - CHECK(is_secondary(pc, act.hp_node), ""); - const auto node = nodes.find(act.hp_node); + CHECK_EQ(act.node1, act.target1); + CHECK_EQ(act.hp_node1, act.hp_target1); + CHECK(is_secondary(pc, act.node1), ""); + CHECK(is_secondary(pc, act.hp_node1), ""); + const auto node = nodes.find(act.hp_node1); CHECK(node != nodes.end(), ""); ns = &node->second; - SET_OBJ_IP_AND_HOST_PORT(pc, primary, act, node); + SET_OBJ_IP_AND_HOST_PORT(pc, primary, act, node1); std::remove(pc.secondaries.begin(), pc.secondaries.end(), pc.primary); std::remove(pc.hp_secondaries.begin(), pc.hp_secondaries.end(), pc.hp_primary); CHECK_EQ(ns->served_as(pc.pid), partition_status::PS_SECONDARY); diff --git a/src/meta/test/meta_partition_guardian_test.cpp b/src/meta/test/meta_partition_guardian_test.cpp index 927d26ea09..b980453305 100644 --- a/src/meta/test/meta_partition_guardian_test.cpp +++ b/src/meta/test/meta_partition_guardian_test.cpp @@ -81,27 +81,27 @@ static void apply_update_request(/*in-out*/ configuration_update_request &update switch (update_req.type) { case config_type::CT_ASSIGN_PRIMARY: case config_type::CT_UPGRADE_TO_PRIMARY: - SET_OBJ_IP_AND_HOST_PORT(pc, primary, update_req, node); + SET_OBJ_IP_AND_HOST_PORT(pc, primary, update_req, node1); // TODO(yingchun): optimize the following code - replica_helper::remove_node(update_req.node, pc.secondaries); - replica_helper::remove_node(update_req.hp_node, pc.hp_secondaries); + replica_helper::remove_node(update_req.node1, pc.secondaries); + replica_helper::remove_node(update_req.hp_node1, pc.hp_secondaries); break; case config_type::CT_ADD_SECONDARY: case config_type::CT_ADD_SECONDARY_FOR_LB: - ADD_IP_AND_HOST_PORT(pc, secondaries, update_req.node, update_req.hp_node); + ADD_IP_AND_HOST_PORT(pc, secondaries, update_req.node1, update_req.hp_node1); update_req.type = config_type::CT_UPGRADE_TO_SECONDARY; break; case config_type::CT_REMOVE: case config_type::CT_DOWNGRADE_TO_INACTIVE: - if (update_req.hp_node == pc.hp_primary) { - CHECK_EQ(update_req.node, pc.primary); + if (update_req.hp_node1 == pc.hp_primary) { + CHECK_EQ(update_req.node1, pc.primary); RESET_IP_AND_HOST_PORT(pc, primary); } else { - CHECK_NE(update_req.node, pc.primary); - replica_helper::remove_node(update_req.node, pc.secondaries); - replica_helper::remove_node(update_req.hp_node, pc.hp_secondaries); + CHECK_NE(update_req.node1, pc.primary); + replica_helper::remove_node(update_req.node1, pc.secondaries); + replica_helper::remove_node(update_req.hp_node1, pc.hp_secondaries); } break; @@ -235,12 +235,12 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_UPGRADE_TO_PRIMARY); - EXPECT_TRUE(is_secondary(pc, update_req->hp_node)); - EXPECT_TRUE(is_secondary(pc, update_req->node)); - EXPECT_EQ(target, update_req->hp_node); - EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node); + EXPECT_TRUE(is_secondary(pc, update_req->hp_node1)); + EXPECT_TRUE(is_secondary(pc, update_req->node1)); + EXPECT_EQ(target, update_req->hp_node1); + EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node1); - last_addr = update_req->hp_node; + last_addr = update_req->hp_node1; proposal_sent = true; return nullptr; }); @@ -260,10 +260,10 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(config_type::CT_UPGRADE_TO_PRIMARY, update_req->type); - EXPECT_EQ(update_req->hp_node, last_addr); - EXPECT_EQ(update_req->node, dsn::dns_resolver::instance().resolve_address(last_addr)); - EXPECT_EQ(target, update_req->hp_node); - EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node); + EXPECT_EQ(update_req->hp_node1, last_addr); + EXPECT_EQ(update_req->node1, dsn::dns_resolver::instance().resolve_address(last_addr)); + EXPECT_EQ(target, update_req->hp_node1); + EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node1); proposal_sent = true; apply_update_request(*update_req); @@ -299,13 +299,13 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_UPGRADE_TO_PRIMARY); - EXPECT_TRUE(is_secondary(pc, update_req->hp_node)); - EXPECT_TRUE(is_secondary(pc, update_req->node)); - EXPECT_EQ(target, update_req->hp_node); - EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node); + EXPECT_TRUE(is_secondary(pc, update_req->hp_node1)); + EXPECT_TRUE(is_secondary(pc, update_req->node1)); + EXPECT_EQ(target, update_req->hp_node1); + EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node1); proposal_sent = true; - last_addr = update_req->hp_node; + last_addr = update_req->hp_node1; svc->set_node_state({target}, false); return nullptr; }); @@ -325,10 +325,10 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_UPGRADE_TO_PRIMARY); - EXPECT_TRUE(is_secondary(pc, update_req->hp_node)); - EXPECT_TRUE(is_secondary(pc, update_req->node)); - EXPECT_EQ(target, update_req->hp_node); - EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node); + EXPECT_TRUE(is_secondary(pc, update_req->hp_node1)); + EXPECT_TRUE(is_secondary(pc, update_req->node1)); + EXPECT_EQ(target, update_req->hp_node1); + EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), update_req->node1); EXPECT_NE(target, last_addr); proposal_sent = true; @@ -364,11 +364,11 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_FALSE(is_secondary(pc, update_req->hp_node)); - EXPECT_FALSE(is_secondary(pc, update_req->node)); + EXPECT_FALSE(is_secondary(pc, update_req->hp_node1)); + EXPECT_FALSE(is_secondary(pc, update_req->node1)); EXPECT_EQ(target, nodes[0]); - last_addr = update_req->hp_node; + last_addr = update_req->hp_node1; proposal_sent = true; return nullptr; }); @@ -388,8 +388,8 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_EQ(update_req->hp_node, last_addr); - EXPECT_EQ(update_req->node, dsn::dns_resolver::instance().resolve_address(last_addr)); + EXPECT_EQ(update_req->hp_node1, last_addr); + EXPECT_EQ(update_req->node1, dsn::dns_resolver::instance().resolve_address(last_addr)); EXPECT_EQ(target, nodes[0]); proposal_sent = true; @@ -425,13 +425,13 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_FALSE(is_secondary(pc, update_req->hp_node)); - EXPECT_FALSE(is_secondary(pc, update_req->node)); + EXPECT_FALSE(is_secondary(pc, update_req->hp_node1)); + EXPECT_FALSE(is_secondary(pc, update_req->node1)); EXPECT_EQ(target, nodes[0]); update_req->config.ballot++; update_req->type = config_type::CT_DOWNGRADE_TO_INACTIVE; - SET_OBJ_IP_AND_HOST_PORT(*update_req, node, update_req->config, secondaries[0]); + SET_OBJ_IP_AND_HOST_PORT(*update_req, node1, update_req->config, secondaries[0]); CLEAR_IP_AND_HOST_PORT(update_req->config, secondaries); proposal_sent = true; @@ -467,12 +467,12 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_FALSE(is_secondary(pc, update_req->hp_node)); - EXPECT_FALSE(is_secondary(pc, update_req->node)); + EXPECT_FALSE(is_secondary(pc, update_req->hp_node1)); + EXPECT_FALSE(is_secondary(pc, update_req->node1)); EXPECT_EQ(target, nodes[0]); - last_addr = update_req->hp_node; - svc->set_node_state({update_req->hp_node}, false); + last_addr = update_req->hp_node1; + svc->set_node_state({update_req->hp_node1}, false); proposal_sent = true; return nullptr; }); @@ -492,13 +492,13 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_NE(update_req->hp_node, last_addr); - EXPECT_FALSE(is_secondary(pc, update_req->hp_node)); - EXPECT_FALSE(is_secondary(pc, update_req->node)); + EXPECT_NE(update_req->hp_node1, last_addr); + EXPECT_FALSE(is_secondary(pc, update_req->hp_node1)); + EXPECT_FALSE(is_secondary(pc, update_req->node1)); EXPECT_EQ(target, nodes[0]); proposal_sent = true; - last_addr = update_req->hp_node; + last_addr = update_req->hp_node1; apply_update_request(*update_req); svc->set_filter(default_filter); return update_req; @@ -531,8 +531,8 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ADD_SECONDARY); - EXPECT_FALSE(is_secondary(pc, update_req->hp_node)); - EXPECT_FALSE(is_secondary(pc, update_req->node)); + EXPECT_FALSE(is_secondary(pc, update_req->hp_node1)); + EXPECT_FALSE(is_secondary(pc, update_req->node1)); EXPECT_EQ(target, pc.hp_primary); EXPECT_EQ(dsn::dns_resolver::instance().resolve_address(target), pc.primary); @@ -566,7 +566,7 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ASSIGN_PRIMARY); - EXPECT_EQ(update_req->hp_node, nodes[2]); + EXPECT_EQ(update_req->hp_node1, nodes[2]); EXPECT_EQ(target, nodes[2]); proposal_sent = true; @@ -631,7 +631,7 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ASSIGN_PRIMARY); - EXPECT_EQ(update_req->hp_node, nodes[1]); + EXPECT_EQ(update_req->hp_node1, nodes[1]); EXPECT_EQ(target, nodes[1]); proposal_sent = true; @@ -725,7 +725,7 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ASSIGN_PRIMARY); - EXPECT_EQ(update_req->hp_node, nodes[1]); + EXPECT_EQ(update_req->hp_node1, nodes[1]); EXPECT_EQ(target, nodes[1]); proposal_sent = true; @@ -751,7 +751,7 @@ void meta_partition_guardian_test::cure_test() destroy_message(recv_request); EXPECT_EQ(update_req->type, config_type::CT_ASSIGN_PRIMARY); - EXPECT_EQ(update_req->hp_node, nodes[0]); + EXPECT_EQ(update_req->hp_node1, nodes[0]); EXPECT_EQ(target, nodes[0]); proposal_sent = true; @@ -835,8 +835,8 @@ void meta_partition_guardian_test::cure() fake_request.info = *app; fake_request.config = pc; fake_request.type = action.type; - SET_OBJ_IP_AND_HOST_PORT(fake_request, node, action, node); - fake_request.host_node = action.node; + SET_OBJ_IP_AND_HOST_PORT(fake_request, node1, action, node1); + fake_request.host_node1 = action.node1; guardian.reconfig({&apps, &nodes}, fake_request); check_nodes_loads(nodes); diff --git a/src/meta/test/misc/misc.cpp b/src/meta/test/misc/misc.cpp index d4bfa25a0f..092c9a7c05 100644 --- a/src/meta/test/misc/misc.cpp +++ b/src/meta/test/misc/misc.cpp @@ -236,13 +236,13 @@ void track_disk_info_check_and_apply(const dsn::replication::configuration_propo config_context *cc = get_config_context(apps, pid); CHECK_NOTNULL(cc, ""); - dsn::host_port hp_target, hp_node; - GET_HOST_PORT(act, target, hp_target); - GET_HOST_PORT(act, node, hp_node); + dsn::host_port hp_target, node; + GET_HOST_PORT(act, target1, hp_target); + GET_HOST_PORT(act, node1, node); fs_manager *target_manager = get_fs_manager(manager, hp_target); CHECK_NOTNULL(target_manager, ""); - fs_manager *node_manager = get_fs_manager(manager, hp_node); + fs_manager *node_manager = get_fs_manager(manager, node); CHECK_NOTNULL(node_manager, ""); std::string dir; @@ -260,7 +260,7 @@ void track_disk_info_check_and_apply(const dsn::replication::configuration_propo auto selected = node_manager->find_best_dir_for_new_replica(pid); CHECK_NOTNULL(selected, ""); selected->holding_replicas[pid.get_app_id()].emplace(pid); - cc->collect_serving_replica(hp_node, ri); + cc->collect_serving_replica(node, ri); break; } case config_type::CT_DOWNGRADE_TO_SECONDARY: @@ -270,7 +270,7 @@ void track_disk_info_check_and_apply(const dsn::replication::configuration_propo case config_type::CT_REMOVE: case config_type::CT_DOWNGRADE_TO_INACTIVE: node_manager->remove_replica(pid); - cc->remove_from_serving(hp_node); + cc->remove_from_serving(node); break; default: @@ -290,26 +290,26 @@ void proposal_action_check_and_apply(const configuration_proposal_action &act, ++pc.ballot; CHECK_NE(act.type, config_type::CT_INVALID); - CHECK(act.target, ""); - CHECK(act.node, ""); + CHECK(act.target1, ""); + CHECK(act.node1, ""); if (manager) { track_disk_info_check_and_apply(act, pid, apps, nodes, *manager); } dsn::host_port hp_target, hp_node; - GET_HOST_PORT(act, target, hp_target); - GET_HOST_PORT(act, node, hp_node); + GET_HOST_PORT(act, target1, hp_target); + GET_HOST_PORT(act, node1, hp_node); switch (act.type) { case config_type::CT_ASSIGN_PRIMARY: { - CHECK_EQ(act.hp_node, act.hp_target); - CHECK_EQ(act.node, act.target); + CHECK_EQ(act.hp_node1, act.hp_target1); + CHECK_EQ(act.node1, act.target1); CHECK(!pc.hp_primary, ""); CHECK(!pc.primary, ""); CHECK(pc.hp_secondaries.empty(), ""); CHECK(pc.secondaries.empty(), ""); - SET_IP_AND_HOST_PORT(pc, primary, act.node, hp_node); + SET_IP_AND_HOST_PORT(pc, primary, act.node1, hp_node); const auto node = nodes.find(hp_node); CHECK(node != nodes.end(), ""); ns = &node->second; @@ -319,11 +319,11 @@ void proposal_action_check_and_apply(const configuration_proposal_action &act, } case config_type::CT_ADD_SECONDARY: { CHECK_EQ(hp_target, pc.hp_primary); - CHECK_EQ(act.hp_target, pc.hp_primary); - CHECK_EQ(act.target, pc.primary); + CHECK_EQ(act.hp_target1, pc.hp_primary); + CHECK_EQ(act.target1, pc.primary); CHECK(!is_member(pc, hp_node), ""); - CHECK(!is_member(pc, act.node), ""); - ADD_IP_AND_HOST_PORT(pc, secondaries, act.node, hp_node); + CHECK(!is_member(pc, act.node1), ""); + ADD_IP_AND_HOST_PORT(pc, secondaries, act.node1, hp_node); const auto node = nodes.find(hp_node); CHECK(node != nodes.end(), ""); ns = &node->second; @@ -332,11 +332,11 @@ void proposal_action_check_and_apply(const configuration_proposal_action &act, break; } case config_type::CT_DOWNGRADE_TO_SECONDARY: { - CHECK_EQ(act.hp_node, act.hp_target); - CHECK_EQ(act.node, act.target); + CHECK_EQ(act.hp_node1, act.hp_target1); + CHECK_EQ(act.node1, act.target1); CHECK_EQ(hp_node, hp_target); - CHECK_EQ(act.hp_node, pc.hp_primary); - CHECK_EQ(act.node, pc.primary); + CHECK_EQ(act.hp_node1, pc.hp_primary); + CHECK_EQ(act.node1, pc.primary); CHECK_EQ(hp_node, pc.hp_primary); CHECK(!is_secondary(pc, pc.hp_primary), ""); CHECK(!is_secondary(pc, pc.primary), ""); @@ -352,28 +352,28 @@ void proposal_action_check_and_apply(const configuration_proposal_action &act, CHECK(!pc.hp_primary, ""); CHECK(!pc.primary, ""); CHECK_EQ(hp_node, hp_target); - CHECK_EQ(act.hp_node, act.hp_target); - CHECK_EQ(act.node, act.target); + CHECK_EQ(act.hp_node1, act.hp_target1); + CHECK_EQ(act.node1, act.target1); CHECK(is_secondary(pc, hp_node), ""); - CHECK(is_secondary(pc, act.node), ""); + CHECK(is_secondary(pc, act.node1), ""); const auto node = nodes.find(hp_node); CHECK(node != nodes.end(), ""); ns = &node->second; - SET_IP_AND_HOST_PORT(pc, primary, act.node, hp_node); + SET_IP_AND_HOST_PORT(pc, primary, act.node1, hp_node); CHECK(replica_helper::remove_node(hp_node, pc.hp_secondaries), ""); - CHECK(replica_helper::remove_node(act.node, pc.secondaries), ""); + CHECK(replica_helper::remove_node(act.node1, pc.secondaries), ""); ns->put_partition(pc.pid, true); break; } case config_type::CT_ADD_SECONDARY_FOR_LB: { CHECK_EQ(hp_target, pc.hp_primary); - CHECK_EQ(act.hp_target, pc.hp_primary); - CHECK_EQ(act.target, pc.primary); + CHECK_EQ(act.hp_target1, pc.hp_primary); + CHECK_EQ(act.target1, pc.primary); CHECK(!is_member(pc, hp_node), ""); - CHECK(!is_member(pc, act.node), ""); - CHECK(act.hp_node, ""); - CHECK(act.node, ""); - ADD_IP_AND_HOST_PORT(pc, secondaries, act.node, hp_node); + CHECK(!is_member(pc, act.node1), ""); + CHECK(act.hp_node1, ""); + CHECK(act.node1, ""); + ADD_IP_AND_HOST_PORT(pc, secondaries, act.node1, hp_node); const auto node = nodes.find(hp_node); CHECK(node != nodes.end(), ""); ns = &node->second; @@ -387,12 +387,12 @@ void proposal_action_check_and_apply(const configuration_proposal_action &act, CHECK(pc.hp_primary, ""); CHECK(pc.primary, ""); CHECK_EQ(pc.hp_primary, hp_target); - CHECK_EQ(pc.hp_primary, act.hp_target); - CHECK_EQ(pc.primary, act.target); + CHECK_EQ(pc.hp_primary, act.hp_target1); + CHECK_EQ(pc.primary, act.target1); CHECK(is_secondary(pc, hp_node), ""); - CHECK(is_secondary(pc, act.node), ""); + CHECK(is_secondary(pc, act.node1), ""); CHECK(replica_helper::remove_node(hp_node, pc.hp_secondaries), ""); - CHECK(replica_helper::remove_node(act.node, pc.secondaries), ""); + CHECK(replica_helper::remove_node(act.node1, pc.secondaries), ""); const auto node = nodes.find(hp_node); CHECK(node != nodes.end(), ""); ns = &node->second; @@ -433,8 +433,8 @@ void migration_check_and_apply(app_mapper &apps, LOG_DEBUG("the {}th round of action, type: {}, node: {}, target: {}", j, dsn::enum_to_string(act.type), - FMT_HOST_PORT_AND_IP(act, node), - FMT_HOST_PORT_AND_IP(act, target)); + FMT_HOST_PORT_AND_IP(act, node1), + FMT_HOST_PORT_AND_IP(act, target1)); proposal_action_check_and_apply(act, proposal->gpid, apps, nodes, manager); } } diff --git a/src/meta/test/update_configuration_test.cpp b/src/meta/test/update_configuration_test.cpp index f4c8e9702e..28c98f3aae 100644 --- a/src/meta/test/update_configuration_test.cpp +++ b/src/meta/test/update_configuration_test.cpp @@ -106,26 +106,26 @@ class fake_sender_meta_service : public dsn::replication::meta_service switch (update_req->type) { case config_type::CT_ASSIGN_PRIMARY: case config_type::CT_UPGRADE_TO_PRIMARY: - SET_OBJ_IP_AND_HOST_PORT(pc, primary, *update_req, node); - replica_helper::remove_node(update_req->node, pc.secondaries); - replica_helper::remove_node(update_req->hp_node, pc.hp_secondaries); + SET_OBJ_IP_AND_HOST_PORT(pc, primary, *update_req, node1); + replica_helper::remove_node(update_req->node1, pc.secondaries); + replica_helper::remove_node(update_req->hp_node1, pc.hp_secondaries); break; case config_type::CT_ADD_SECONDARY: case config_type::CT_ADD_SECONDARY_FOR_LB: - ADD_IP_AND_HOST_PORT(pc, secondaries, update_req->node, update_req->hp_node); + ADD_IP_AND_HOST_PORT(pc, secondaries, update_req->node1, update_req->hp_node1); update_req->type = config_type::CT_UPGRADE_TO_SECONDARY; break; case config_type::CT_REMOVE: case config_type::CT_DOWNGRADE_TO_INACTIVE: - if (update_req->hp_node == pc.hp_primary) { - CHECK_EQ(update_req->node, pc.primary); + if (update_req->hp_node1 == pc.hp_primary) { + CHECK_EQ(update_req->node1, pc.primary); RESET_IP_AND_HOST_PORT(pc, primary); } else { - CHECK_NE(update_req->node, pc.primary); - replica_helper::remove_node(update_req->node, pc.secondaries); - replica_helper::remove_node(update_req->hp_node, pc.hp_secondaries); + CHECK_NE(update_req->node1, pc.primary); + replica_helper::remove_node(update_req->node1, pc.secondaries); + replica_helper::remove_node(update_req->hp_node1, pc.hp_secondaries); } break; @@ -349,7 +349,7 @@ void meta_service_test_app::adjust_dropped_size() req->config.ballot++; SET_IPS_AND_HOST_PORTS_BY_DNS(req->config, secondaries, nodes[5]); req->info = info; - SET_IP_AND_HOST_PORT_BY_DNS(*req, node, nodes[5]); + SET_IP_AND_HOST_PORT_BY_DNS(*req, node1, nodes[5]); req->type = config_type::CT_UPGRADE_TO_SECONDARY; call_update_configuration(svc.get(), req); @@ -358,7 +358,7 @@ void meta_service_test_app::adjust_dropped_size() // then receive a config_sync request fro nodes[4], which has less data than node[3] std::shared_ptr req2 = std::make_shared(); - SET_IP_AND_HOST_PORT_BY_DNS(*req2, node, nodes[4]); + SET_IP_AND_HOST_PORT_BY_DNS(*req2, node1, nodes[4]); replica_info rep_info; rep_info.pid = pc.pid; diff --git a/src/replica/replica_config.cpp b/src/replica/replica_config.cpp index a0b1ae82c9..682467eeff 100644 --- a/src/replica/replica_config.cpp +++ b/src/replica/replica_config.cpp @@ -104,7 +104,7 @@ void replica::on_config_proposal(configuration_update_request &proposal) LOG_INFO_PREFIX("process config proposal {} for {}", enum_to_string(proposal.type), - FMT_HOST_PORT_AND_IP(proposal, node)); + FMT_HOST_PORT_AND_IP(proposal, node1)); if (proposal.config.ballot < get_ballot()) { LOG_WARNING_PREFIX( @@ -246,13 +246,13 @@ void replica::add_potential_secondary(const configuration_update_request &propos group_check_request request; request.app = _app_info; - SET_OBJ_IP_AND_HOST_PORT(request, node1, proposal, node1); + SET_OBJ_IP_AND_HOST_PORT(request, node, proposal, node1); _primary_states.get_replica_config( partition_status::PS_POTENTIAL_SECONDARY, request.config, state.signature); request.last_committed_decree = last_committed_decree(); LOG_INFO_PREFIX("call one way {} to start learning with signature [{:#018x}]", - FMT_HOST_PORT_AND_IP(proposal, node), + FMT_HOST_PORT_AND_IP(proposal, node1), state.signature); rpc::call_one_way_typed(dsn::dns_resolver::instance().resolve_address(node), @@ -291,14 +291,14 @@ void replica::downgrade_to_secondary_on_primary(configuration_update_request &pr CHECK(_primary_states.pc.__isset.hp_secondaries, ""); CHECK(secondaries == _primary_states.pc.hp_secondaries, ""); dsn::host_port node; - GET_HOST_PORT(proposal, node, node); + GET_HOST_PORT(proposal, node1, node); CHECK_EQ(node, primary); - CHECK_EQ(proposal.node, proposal.config.primary); + CHECK_EQ(proposal.node1, proposal.config.primary); RESET_IP_AND_HOST_PORT(proposal.config, primary); - ADD_IP_AND_HOST_PORT(proposal.config, secondaries, proposal.node, proposal.hp_node); + ADD_IP_AND_HOST_PORT(proposal.config, secondaries, proposal.node1, proposal.hp_node1); update_configuration_on_meta_server( - config_type::CT_DOWNGRADE_TO_SECONDARY, proposal.hp_node, proposal.config); + config_type::CT_DOWNGRADE_TO_SECONDARY, proposal.hp_node1, proposal.config); } void replica::downgrade_to_inactive_on_primary(configuration_update_request &proposal) @@ -319,15 +319,15 @@ void replica::downgrade_to_inactive_on_primary(configuration_update_request &pro CHECK(secondaries == _primary_states.pc.hp_secondaries, ""); host_port node; - GET_HOST_PORT(proposal, node, node); + GET_HOST_PORT(proposal, node1, node); if (node == primary) { - CHECK_EQ(proposal.node, proposal.config.primary); + CHECK_EQ(proposal.node1, proposal.config.primary); RESET_IP_AND_HOST_PORT(proposal.config, primary); } else { - CHECK_NE(proposal.node, proposal.config.primary); - CHECK(replica_helper::remove_node(proposal.node, proposal.config.secondaries), + CHECK_NE(proposal.node1, proposal.config.primary); + CHECK(replica_helper::remove_node(proposal.node1, proposal.config.secondaries), "remove node failed, node = {}", - proposal.node); + proposal.node1); CHECK(proposal.config.__isset.hp_secondaries, "The proposal's partition_configuration is not normalized"); CHECK(replica_helper::remove_node(node, proposal.config.hp_secondaries), @@ -359,19 +359,19 @@ void replica::remove(configuration_update_request &proposal) CHECK(secondaries == _primary_states.pc.hp_secondaries, ""); host_port node; - GET_HOST_PORT(proposal, node, node); + GET_HOST_PORT(proposal, node1, node); auto st = _primary_states.get_node_status(node); switch (st) { case partition_status::PS_PRIMARY: CHECK_EQ(primary, node); - CHECK_EQ(proposal.config.primary, proposal.node); + CHECK_EQ(proposal.config.primary, proposal.node1); RESET_IP_AND_HOST_PORT(proposal.config, primary); break; case partition_status::PS_SECONDARY: { - CHECK(replica_helper::remove_node(proposal.node, proposal.config.secondaries), + CHECK(replica_helper::remove_node(proposal.node1, proposal.config.secondaries), "remove node failed, node = {}", - proposal.node); + proposal.node1); CHECK(proposal.config.__isset.hp_secondaries, "The proposal's partition_configuration is not normalized"); CHECK(replica_helper::remove_node(node, proposal.config.hp_secondaries), @@ -453,7 +453,7 @@ void replica::update_configuration_on_meta_server(config_type::type type, request->config = new_pc; request->config.ballot++; request->type = type; - SET_IP_AND_HOST_PORT_BY_DNS(*request, node, node); + SET_IP_AND_HOST_PORT_BY_DNS(*request, node1, node); ::dsn::marshall(msg, *request); @@ -465,7 +465,7 @@ void replica::update_configuration_on_meta_server(config_type::type type, "send update configuration request to meta server, ballot = {}, type = {}, node = {}", request->config.ballot, enum_to_string(request->type), - FMT_HOST_PORT_AND_IP(*request, node)); + FMT_HOST_PORT_AND_IP(*request, node1)); rpc_address target( dsn::dns_resolver::instance().resolve_address(_stub->_failure_detector->get_servers())); @@ -572,9 +572,9 @@ void replica::on_update_configuration_on_meta_server_reply( break; case config_type::CT_REMOVE: { host_port node; - GET_HOST_PORT(*req, node, node); + GET_HOST_PORT(*req, node1, node); if (node != _stub->primary_host_port()) { - CHECK_NE(req->node, _stub->primary_address()); + CHECK_NE(req->node1, _stub->primary_address()); replica_configuration rconfig; replica_helper::get_replica_config(resp.config, node, rconfig); rpc::call_one_way_typed(dsn::dns_resolver::instance().resolve_address(node), diff --git a/src/replica/storage/simple_kv/test/checker.cpp b/src/replica/storage/simple_kv/test/checker.cpp index de6e52c552..e2395725f3 100644 --- a/src/replica/storage/simple_kv/test/checker.cpp +++ b/src/replica/storage/simple_kv/test/checker.cpp @@ -86,10 +86,10 @@ class checker_partition_guardian : public partition_guardian pc_status result; if (!pc.hp_primary) { if (pc.hp_secondaries.size() > 0) { - SET_OBJ_IP_AND_HOST_PORT(action, node, pc, secondaries[0]); + SET_OBJ_IP_AND_HOST_PORT(action, node1, pc, secondaries[0]); for (unsigned int i = 1; i < pc.hp_secondaries.size(); ++i) - if (pc.hp_secondaries[i] < action.hp_node) { - SET_OBJ_IP_AND_HOST_PORT(action, node, pc, secondaries[i]); + if (pc.hp_secondaries[i] < action.hp_node1) { + SET_OBJ_IP_AND_HOST_PORT(action, node1, pc, secondaries[i]); } action.type = config_type::CT_UPGRADE_TO_PRIMARY; result = pc_status::ill; @@ -100,7 +100,7 @@ class checker_partition_guardian : public partition_guardian sort_alive_nodes(*view.nodes, server_load_balancer::primary_comparator(*view.nodes), sort_result); - SET_IP_AND_HOST_PORT_BY_DNS(action, node, sort_result[0]); + SET_IP_AND_HOST_PORT_BY_DNS(action, node1, sort_result[0]); action.type = config_type::CT_ASSIGN_PRIMARY; result = pc_status::ill; } @@ -108,15 +108,15 @@ class checker_partition_guardian : public partition_guardian // DDD else { SET_IP_AND_HOST_PORT( - action, node, *pc.last_drops.rbegin(), *pc.hp_last_drops.rbegin()); + action, node1, *pc.last_drops.rbegin(), *pc.hp_last_drops.rbegin()); action.type = config_type::CT_ASSIGN_PRIMARY; LOG_ERROR("{} enters DDD state, we are waiting for its last primary node {} to " "come back ...", pc.pid, - FMT_HOST_PORT_AND_IP(action, node)); + FMT_HOST_PORT_AND_IP(action, node1)); result = pc_status::dead; } - SET_OBJ_IP_AND_HOST_PORT(action, target, action, node); + SET_OBJ_IP_AND_HOST_PORT(action, target1, action, node1); } else if (static_cast(pc.hp_secondaries.size()) + 1 < pc.max_replica_count) { @@ -126,11 +126,11 @@ class checker_partition_guardian : public partition_guardian for (auto &node : sort_result) { if (!is_member(pc, node)) { - SET_IP_AND_HOST_PORT_BY_DNS(action, node, node); + SET_IP_AND_HOST_PORT_BY_DNS(action, node1, node); break; } } - SET_OBJ_IP_AND_HOST_PORT(action, target, pc, primary); + SET_OBJ_IP_AND_HOST_PORT(action, target1, pc, primary); action.type = config_type::CT_ADD_SECONDARY; result = pc_status::ill; } else { diff --git a/src/replica/storage/simple_kv/test/client.cpp b/src/replica/storage/simple_kv/test/client.cpp index ff1587bda5..caa0785349 100644 --- a/src/replica/storage/simple_kv/test/client.cpp +++ b/src/replica/storage/simple_kv/test/client.cpp @@ -159,8 +159,8 @@ void simple_kv_client_app::send_config_to_meta(const host_port &receiver, request.gpid = g_default_gpid; configuration_proposal_action act; - SET_IP_AND_HOST_PORT_BY_DNS(act, node, node); - SET_IP_AND_HOST_PORT_BY_DNS(act, target, receiver); + SET_IP_AND_HOST_PORT_BY_DNS(act, node1, node); + SET_IP_AND_HOST_PORT_BY_DNS(act, target1, receiver); act.__set_type(type); request.action_list.emplace_back(std::move(act)); request.__set_force(true); diff --git a/src/replica/test/open_replica_test.cpp b/src/replica/test/open_replica_test.cpp index 75094de5e9..0a3e4734aa 100644 --- a/src/replica/test/open_replica_test.cpp +++ b/src/replica/test/open_replica_test.cpp @@ -82,7 +82,7 @@ TEST_P(open_replica_test, open_replica_add_decree_and_ballot_check) req->info = *as; req->config = pc; req->type = config_type::CT_ASSIGN_PRIMARY; - SET_IP_AND_HOST_PORT_BY_DNS(*req, node, node); + SET_IP_AND_HOST_PORT_BY_DNS(*req, node1, node); if (test.expect_crash) { ASSERT_DEATH(stub->open_replica(ai, pid, nullptr, req), ""); } else { diff --git a/src/runtime/test/host_port_test.cpp b/src/runtime/test/host_port_test.cpp index 70d3699e1e..c49efb1182 100644 --- a/src/runtime/test/host_port_test.cpp +++ b/src/runtime/test/host_port_test.cpp @@ -321,24 +321,24 @@ TEST(host_port_test, test_macros) { replication::configuration_recovery_request req; std::vector recovery_nodes; - GET_HOST_PORTS(req, recovery_nodes, recovery_nodes); + GET_HOST_PORTS(req, recovery_nodes1, recovery_nodes); ASSERT_TRUE(recovery_nodes.empty()); } // Test GET_HOST_PORTS-2. { replication::configuration_recovery_request req; - req.__set_recovery_nodes(kAddres); + req.__set_recovery_nodes1(kAddres); std::vector recovery_nodes; - GET_HOST_PORTS(req, recovery_nodes, recovery_nodes); + GET_HOST_PORTS(req, recovery_nodes1, recovery_nodes); ASSERT_EQ(kHps, recovery_nodes); } // Test GET_HOST_PORTS-2. { replication::configuration_recovery_request req; - req.__set_recovery_nodes(kAddres); - req.__set_hp_recovery_nodes(kHps); + req.__set_recovery_nodes1(kAddres); + req.__set_hp_recovery_nodes1(kHps); std::vector recovery_nodes; - GET_HOST_PORTS(req, recovery_nodes, recovery_nodes); + GET_HOST_PORTS(req, recovery_nodes1, recovery_nodes); ASSERT_EQ(kHps, recovery_nodes); } diff --git a/src/shell/commands/recovery.cpp b/src/shell/commands/recovery.cpp index 9720e9f0d7..ffd6c98906 100644 --- a/src/shell/commands/recovery.cpp +++ b/src/shell/commands/recovery.cpp @@ -176,7 +176,7 @@ dsn::host_port diagnose_recommend(const ddd_partition_info &pinfo) for (auto &node : last_two_nodes) { auto it = std::find_if(pinfo.dropped.begin(), pinfo.dropped.end(), - [&node](const ddd_node_info &r) { return r.hp_node == node; }); + [&node](const ddd_node_info &r) { return r.hp_node1 == node; }); if (it->is_alive && it->is_collected) last_dropped.push_back(*it); } @@ -184,7 +184,7 @@ dsn::host_port diagnose_recommend(const ddd_partition_info &pinfo) if (last_dropped.size() == 1) { const ddd_node_info &ninfo = last_dropped.back(); if (ninfo.last_committed_decree >= pinfo.config.last_committed_decree) { - return ninfo.hp_node; + return ninfo.hp_node1; } } else if (last_dropped.size() == 2) { const ddd_node_info &secondary = last_dropped.front(); @@ -196,17 +196,17 @@ dsn::host_port diagnose_recommend(const ddd_partition_info &pinfo) if (latest.last_committed_decree == secondary.last_committed_decree && latest.last_committed_decree >= pinfo.config.last_committed_decree) { - return latest.ballot >= secondary.ballot ? latest.hp_node : secondary.hp_node; + return latest.ballot >= secondary.ballot ? latest.hp_node1 : secondary.hp_node1; } if (latest.last_committed_decree > secondary.last_committed_decree && latest.last_committed_decree >= pinfo.config.last_committed_decree) { - return latest.hp_node; + return latest.hp_node1; } if (secondary.last_committed_decree > latest.last_committed_decree && secondary.last_committed_decree >= pinfo.config.last_committed_decree) { - return secondary.hp_node; + return secondary.hp_node1; } } @@ -303,7 +303,7 @@ bool ddd_diagnose(command_executor *e, shell_context *sc, arguments args) int j = 0; for (const ddd_node_info &n : pinfo.dropped) { dsn::host_port hp_node; - GET_HOST_PORT(n, node, hp_node); + GET_HOST_PORT(n, node1, hp_node); char time_buf[30] = {0}; ::dsn::utils::time_ms_to_string(n.drop_time_ms, time_buf); out << " dropped[" << j++ << "]: "