diff --git a/src/meta/cluster_balance_policy.cpp b/src/meta/cluster_balance_policy.cpp index e6897cc7e7..faa2e9f461 100644 --- a/src/meta/cluster_balance_policy.cpp +++ b/src/meta/cluster_balance_policy.cpp @@ -226,13 +226,18 @@ bool cluster_balance_policy::get_app_migration_info(std::shared_ptr a info.partitions.resize(app->pcs.size()); for (auto i = 0; i < app->pcs.size(); ++i) { std::map pstatus_map; - pstatus_map[app->pcs[i].hp_primary1] = partition_status::PS_PRIMARY; - if (app->pcs[i].hp_secondaries1.size() != app->pcs[i].max_replica_count - 1) { + host_port primary; + GET_HOST_PORT(app->pcs[i], primary1, primary); + pstatus_map[primary] = partition_status::PS_PRIMARY; + + std::vector secondaries; + GET_HOST_PORTS(app->pcs[i], secondaries1, secondaries); + if (secondaries.size() != app->pcs[i].max_replica_count - 1) { // partition is unhealthy return false; } - for (const auto &hp : app->pcs[i].hp_secondaries1) { - pstatus_map[hp] = partition_status::PS_SECONDARY; + for (const auto &secondary : secondaries) { + pstatus_map[secondary] = partition_status::PS_SECONDARY; } info.partitions[i] = pstatus_map; }