Skip to content

Commit

Permalink
revert rename
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 22, 2024
1 parent f03404b commit f08ce98
Show file tree
Hide file tree
Showing 62 changed files with 591 additions and 591 deletions.
12 changes: 6 additions & 6 deletions idl/dsn.layer2.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ struct partition_configuration
1:dsn.gpid pid;
2:i64 ballot;
3:i32 max_replica_count;
4:dsn.rpc_address primary1;
5:list<dsn.rpc_address> secondaries1;
6:list<dsn.rpc_address> last_drops1;
4:dsn.rpc_address primary;
5:list<dsn.rpc_address> secondaries;
6:list<dsn.rpc_address> last_drops;
7:i64 last_committed_decree;
8:i32 partition_flags;
9:optional dsn.host_port hp_primary1;
10:optional list<dsn.host_port> hp_secondaries1;
11:optional list<dsn.host_port> hp_last_drops1;
9:optional dsn.host_port hp_primary;
10:optional list<dsn.host_port> hp_secondaries;
11:optional list<dsn.host_port> hp_last_drops;
}

struct query_cfg_request
Expand Down
6 changes: 3 additions & 3 deletions src/client/partition_resolver_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void partition_resolver_simple::query_config_reply(error_code err,
LOG_DEBUG_PREFIX("query config reply, gpid = {}, ballot = {}, primary = {}",
new_pc.pid,
new_pc.ballot,
FMT_HOST_PORT_AND_IP(new_pc, primary1));
FMT_HOST_PORT_AND_IP(new_pc, primary));

auto it2 = _config_cache.find(new_pc.pid.get_partition_index());
if (it2 == _config_cache.end()) {
Expand Down Expand Up @@ -415,12 +415,12 @@ host_port partition_resolver_simple::get_host_port(const partition_configuration
{
if (_app_is_stateful) {
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
return primary;
}

std::vector<host_port> last_drops;
GET_HOST_PORTS(pc, last_drops1, last_drops);
GET_HOST_PORTS(pc, last_drops, last_drops);
if (last_drops.empty()) {
return host_port();
}
Expand Down
16 changes: 8 additions & 8 deletions src/client/replication_ddl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ dsn::error_code replication_ddl_client::wait_app_ready(const std::string &app_na
for (int i = 0; i < partition_count; i++) {
const auto &pc = query_resp.partitions[i];
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (!primary) {
continue;
}

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
if (secondaries.size() + 1 < max_replica_count) {
continue;
}
Expand Down Expand Up @@ -446,13 +446,13 @@ dsn::error_code replication_ddl_client::list_apps(const dsn::app_status::type st
for (const auto &pc : pcs) {
int replica_count = 0;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (primary) {
replica_count++;
}

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
replica_count += secondaries.size();
if (primary) {
if (replica_count >= pc.max_replica_count) {
Expand Down Expand Up @@ -589,7 +589,7 @@ dsn::error_code replication_ddl_client::list_nodes(const dsn::replication::node_

for (const auto &pc : pcs) {
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (primary) {
auto find = tmp_map.find(primary);
if (find != tmp_map.end()) {
Expand All @@ -598,7 +598,7 @@ dsn::error_code replication_ddl_client::list_nodes(const dsn::replication::node_
}

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
for (const auto &secondary : secondaries) {
auto find = tmp_map.find(secondary);
if (find != tmp_map.end()) {
Expand Down Expand Up @@ -787,14 +787,14 @@ dsn::error_code replication_ddl_client::list_app(const std::string &app_name,
for (const auto &pc : pcs) {
int replica_count = 0;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (primary) {
replica_count++;
node_stat[primary].first++;
total_prim_count++;
}
std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
replica_count += secondaries.size();
total_sec_count += secondaries.size();
if (primary) {
Expand Down
12 changes: 6 additions & 6 deletions src/common/json_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,14 +717,14 @@ NON_MEMBER_JSON_SERIALIZATION(dsn::partition_configuration,
pid,
ballot,
max_replica_count,
primary1,
secondaries1,
last_drops1,
primary,
secondaries,
last_drops,
last_committed_decree,
partition_flags,
hp_primary1,
hp_secondaries1,
hp_last_drops1)
hp_primary,
hp_secondaries,
hp_last_drops)

NON_MEMBER_JSON_SERIALIZATION(dsn::app_info,
status,
Expand Down
6 changes: 3 additions & 3 deletions src/common/replication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ int32_t replication_options::app_mutation_2pc_min_replica_count(int32_t app_max_
rc.pid = pc.pid;
rc.ballot = pc.ballot;
rc.learner_signature = invalid_signature;
SET_OBJ_IP_AND_HOST_PORT(rc, primary, pc, primary1);
SET_OBJ_IP_AND_HOST_PORT(rc, primary, pc, primary);

host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (node == primary) {
rc.status = partition_status::PS_PRIMARY;
return true;
}

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
if (utils::contains(secondaries, node)) {
rc.status = partition_status::PS_SECONDARY;
return true;
Expand Down
16 changes: 8 additions & 8 deletions src/common/replication_other_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ typedef int64_t decree;

inline bool is_primary(const partition_configuration &pc, const host_port &node)
{
return node && pc.hp_primary1 == node;
return node && pc.hp_primary == node;
}
inline bool is_primary(const partition_configuration &pc, const rpc_address &node)
{
return node && pc.primary1 == node;
return node && pc.primary == node;
}
inline bool is_secondary(const partition_configuration &pc, const host_port &node)
{
return node && utils::contains(pc.hp_secondaries1, node);
return node && utils::contains(pc.hp_secondaries, node);
}
inline bool is_secondary(const partition_configuration &pc, const rpc_address &node)
{
return node && utils::contains(pc.secondaries1, node);
return node && utils::contains(pc.secondaries, node);
}
inline bool is_member(const partition_configuration &pc, const host_port &node)
{
Expand All @@ -81,7 +81,7 @@ inline bool is_partition_config_equal(const partition_configuration &pc1,
{
// secondaries no need to be same order
std::vector<host_port> pc1_secondaries;
GET_HOST_PORTS(pc1, secondaries1, pc1_secondaries);
GET_HOST_PORTS(pc1, secondaries, pc1_secondaries);
for (const auto &pc1_secondary : pc1_secondaries) {
if (!is_secondary(pc2, pc1_secondary)) {
return false;
Expand All @@ -90,11 +90,11 @@ inline bool is_partition_config_equal(const partition_configuration &pc1,

// last_drops is not considered into equality check
host_port pc1_primary;
GET_HOST_PORT(pc1, primary1, pc1_primary);
GET_HOST_PORT(pc1, primary, pc1_primary);
host_port pc2_primary;
GET_HOST_PORT(pc2, primary1, pc2_primary);
GET_HOST_PORT(pc2, primary, pc2_primary);
std::vector<host_port> pc2_secondaries;
GET_HOST_PORTS(pc2, secondaries1, pc2_secondaries);
GET_HOST_PORTS(pc2, secondaries, pc2_secondaries);
return pc1.ballot == pc2.ballot && pc1.pid == pc2.pid &&
pc1.max_replica_count == pc2.max_replica_count && pc1_primary == pc2_primary &&
pc1_secondaries.size() == pc2_secondaries.size() &&
Expand Down
2 changes: 1 addition & 1 deletion src/meta/backup_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void backup_engine::backup_app_partition(const gpid &pid)
_is_backup_failed = true;
return;
}
partition_primary = app->pcs[pid.get_partition_index()].hp_primary1;
partition_primary = app->pcs[pid.get_partition_index()].hp_primary;
}

if (!partition_primary) {
Expand Down
6 changes: 3 additions & 3 deletions src/meta/cluster_balance_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ bool cluster_balance_policy::get_app_migration_info(std::shared_ptr<app_state> a
for (const auto &pc : app->pcs) {
std::map<host_port, partition_status::type> pstatus_map;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
pstatus_map[primary] = partition_status::PS_PRIMARY;

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
if (secondaries.size() != pc.max_replica_count - 1) {
// partition is unhealthy
return false;
Expand Down Expand Up @@ -553,7 +553,7 @@ bool cluster_balance_policy::apply_move(const move_info &move,
// add into the migration list and selected_pid
partition_configuration pc;
pc.pid = move.pid;
SET_IP_AND_HOST_PORT_BY_DNS(pc, primary1, primary_hp);
SET_IP_AND_HOST_PORT_BY_DNS(pc, primary, primary_hp);
list[move.pid] = generate_balancer_request(*_global_view->apps, pc, move.type, source, target);
_migration_result->emplace(
move.pid, generate_balancer_request(*_global_view->apps, pc, move.type, source, target));
Expand Down
10 changes: 5 additions & 5 deletions src/meta/duplication/meta_duplication_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ void meta_duplication_service::check_follower_app_if_create_completed(
const host_port secondary2("localhost", 34803);

partition_configuration pc;
SET_IP_AND_HOST_PORT_BY_DNS(pc, primary1, primary);
SET_IPS_AND_HOST_PORTS_BY_DNS(pc, secondaries1, secondary1, secondary2);
SET_IP_AND_HOST_PORT_BY_DNS(pc, primary, primary);
SET_IPS_AND_HOST_PORTS_BY_DNS(pc, secondaries, secondary1, secondary2);
resp.partitions.emplace_back(pc);
}
});
Expand All @@ -562,17 +562,17 @@ void meta_duplication_service::check_follower_app_if_create_completed(
query_err = ERR_INCONSISTENT_STATE;
} else {
for (const auto &pc : resp.partitions) {
if (!pc.hp_primary1) {
if (!pc.hp_primary) {
query_err = ERR_INACTIVE_STATE;
break;
}

if (pc.hp_secondaries1.empty()) {
if (pc.hp_secondaries.empty()) {
query_err = ERR_NOT_ENOUGH_MEMBER;
break;
}

for (const auto &secondary : pc.hp_secondaries1) {
for (const auto &secondary : pc.hp_secondaries) {
if (!secondary) {
query_err = ERR_INACTIVE_STATE;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/meta/load_balance_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ generate_balancer_request(const app_mapper &apps,
ans = "copy_secondary";
result.balance_type = balancer_request_type::copy_secondary;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
result.action_list.emplace_back(
new_proposal_action(primary, to, config_type::CT_ADD_SECONDARY_FOR_LB));
result.action_list.emplace_back(new_proposal_action(primary, from, config_type::CT_REMOVE));
Expand Down Expand Up @@ -571,7 +571,7 @@ void ford_fulkerson::update_decree(int node_id, const node_state &ns)
ns.for_each_primary(_app->app_id, [&, this](const gpid &pid) {
const auto &pc = _app->pcs[pid.get_partition_index()];
std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
for (const auto &secondary : secondaries) {
auto i = _host_port_id.find(secondary);
CHECK(i != _host_port_id.end(), "invalid secondary: {}", secondary);
Expand Down
2 changes: 1 addition & 1 deletion src/meta/meta_backup_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void policy_context::start_backup_partition_unlocked(gpid pid)
pid, cold_backup_constant::PROGRESS_FINISHED, dsn::host_port());
return;
}
partition_primary = app->pcs[pid.get_partition_index()].hp_primary1;
partition_primary = app->pcs[pid.get_partition_index()].hp_primary;
}
if (!partition_primary) {
LOG_WARNING("{}: partition {} doesn't have a primary now, retry to backup it later",
Expand Down
4 changes: 2 additions & 2 deletions src/meta/meta_bulk_load_ingestion_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ void ingestion_context::partition_node_info::create(const partition_configuratio
pid = pc.pid;
std::unordered_set<host_port> current_nodes;
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
current_nodes.insert(primary);
std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
for (const auto &secondary : secondaries) {
current_nodes.insert(secondary);
}
Expand Down
18 changes: 9 additions & 9 deletions src/meta/meta_bulk_load_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ bool bulk_load_service::check_partition_status(

pc = app->pcs[pid.get_partition_index()];
host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
if (!primary) {
LOG_WARNING("app({}) partition({}) primary is invalid, try it later", app_name, pid);
tasking::enqueue(
Expand All @@ -385,7 +385,7 @@ bool bulk_load_service::check_partition_status(
}

std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
if (secondaries.size() < pc.max_replica_count - 1) {
bulk_load_status::type p_status;
{
Expand Down Expand Up @@ -438,7 +438,7 @@ void bulk_load_service::partition_bulk_load(const std::string &app_name, const g
const app_bulk_load_info &ainfo = _app_bulk_load_info[pid.get_app_id()];
req->pid = pid;
req->app_name = app_name;
SET_OBJ_IP_AND_HOST_PORT(*req, primary, pc, primary1);
SET_OBJ_IP_AND_HOST_PORT(*req, primary, pc, primary);
req->remote_provider_name = ainfo.file_provider_type;
req->cluster_name = ainfo.cluster_name;
req->meta_bulk_load_status = get_partition_bulk_load_status_unlocked(pid);
Expand All @@ -449,7 +449,7 @@ void bulk_load_service::partition_bulk_load(const std::string &app_name, const g

LOG_INFO("send bulk load request to node({}), app({}), partition({}), partition "
"status = {}, remote provider = {}, cluster_name = {}, remote_root_path = {}",
FMT_HOST_PORT_AND_IP(pc, primary1),
FMT_HOST_PORT_AND_IP(pc, primary),
app_name,
pid,
dsn::enum_to_string(req->meta_bulk_load_status),
Expand All @@ -458,14 +458,14 @@ void bulk_load_service::partition_bulk_load(const std::string &app_name, const g
req->remote_root_path);

bulk_load_rpc rpc(std::move(req), RPC_BULK_LOAD, 0_ms, 0, pid.thread_hash());
rpc.call(pc.primary1, _meta_svc->tracker(), [this, pid, rpc, pc](error_code err) mutable {
rpc.call(pc.primary, _meta_svc->tracker(), [this, pid, rpc, pc](error_code err) mutable {
// The remote server may not support FQDN, but do not try to reverse resolve the
// IP addresses because they may be unresolved. Just warning and ignore this.
LOG_WARNING_IF(!rpc.response().__isset.hp_group_bulk_load_state,
"The {} primary {} doesn't support FQDN, the response "
"hp_group_bulk_load_state field is not set",
pid,
FMT_HOST_PORT_AND_IP(pc, primary1));
FMT_HOST_PORT_AND_IP(pc, primary));
on_partition_bulk_load_reply(err, rpc.request(), rpc.response());
});
}
Expand Down Expand Up @@ -1206,10 +1206,10 @@ bool bulk_load_service::check_ever_ingestion_succeed(const partition_configurati

std::vector<host_port> current_nodes;
dsn::host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
current_nodes.emplace_back(primary);
std::vector<host_port> secondaries;
GET_HOST_PORTS(pc, secondaries1, secondaries);
GET_HOST_PORTS(pc, secondaries, secondaries);
for (const auto &secondary : secondaries) {
current_nodes.emplace_back(secondary);
}
Expand Down Expand Up @@ -1279,7 +1279,7 @@ void bulk_load_service::partition_ingestion(const std::string &app_name, const g
}

host_port primary;
GET_HOST_PORT(pc, primary1, primary);
GET_HOST_PORT(pc, primary, primary);
tasking::enqueue(
LPC_BULK_LOAD_INGESTION,
_meta_svc->tracker(),
Expand Down
Loading

0 comments on commit f08ce98

Please sign in to comment.