|
35 | 35 | #include "meta_admin_types.h" |
36 | 36 | #include "rpc/dns_resolver.h" // IWYU pragma: keep |
37 | 37 | #include "rpc/rpc_address.h" |
| 38 | +#include "rpc/rpc_host_port.h" |
38 | 39 | #include "utils/command_manager.h" |
39 | 40 | #include "utils/fail_point.h" |
40 | 41 | #include "utils/flags.h" |
@@ -172,14 +173,17 @@ generate_balancer_request(const app_mapper &apps, |
172 | 173 | new_proposal_action(to, to, config_type::CT_UPGRADE_TO_PRIMARY)); |
173 | 174 | result.action_list.emplace_back(new_proposal_action(to, from, config_type::CT_REMOVE)); |
174 | 175 | break; |
175 | | - case balance_type::COPY_SECONDARY: |
| 176 | + case balance_type::COPY_SECONDARY: { |
176 | 177 | ans = "copy_secondary"; |
177 | 178 | result.balance_type = balancer_request_type::copy_secondary; |
| 179 | + host_port primary; |
| 180 | + GET_HOST_PORT(pc, primary, primary); |
178 | 181 | result.action_list.emplace_back( |
179 | | - new_proposal_action(pc.hp_primary, to, config_type::CT_ADD_SECONDARY_FOR_LB)); |
| 182 | + new_proposal_action(primary, to, config_type::CT_ADD_SECONDARY_FOR_LB)); |
180 | 183 | result.action_list.emplace_back( |
181 | | - new_proposal_action(pc.hp_primary, from, config_type::CT_REMOVE)); |
| 184 | + new_proposal_action(primary, from, config_type::CT_REMOVE)); |
182 | 185 | break; |
| 186 | + } |
183 | 187 | default: |
184 | 188 | CHECK(false, ""); |
185 | 189 | } |
@@ -566,7 +570,9 @@ void ford_fulkerson::update_decree(int node_id, const node_state &ns) |
566 | 570 | { |
567 | 571 | ns.for_each_primary(_app->app_id, [&, this](const gpid &pid) { |
568 | 572 | const auto &pc = _app->pcs[pid.get_partition_index()]; |
569 | | - for (const auto &secondary : pc.hp_secondaries) { |
| 573 | + std::vector<host_port> secondaries; |
| 574 | + GET_HOST_PORTS(pc, secondaries, secondaries); |
| 575 | + for (const auto &secondary : secondaries) { |
570 | 576 | auto i = _host_port_id.find(secondary); |
571 | 577 | CHECK(i != _host_port_id.end(), "invalid secondary: {}", secondary); |
572 | 578 | _network[node_id][i->second]++; |
|
0 commit comments