Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 10bda1e

Browse files
committedMay 15, 2025·
refactor(FQDN): feather refactor on idl/dsn.layer2.thrift v2
1 parent f95305a commit 10bda1e

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed
 

‎src/meta/duplication/meta_duplication_service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
765765
} else {
766766
for (const auto &pc : resp.partitions) {
767767
host_port primary;
768-
std::vector<host_port> secondaries;
769768
GET_HOST_PORT(pc, primary, primary);
770-
GET_HOST_PORTS(pc, secondaries, secondaries);
771769
if (!primary) {
772770
// Fail once the primary replica is unavailable.
773771
query_err = ERR_INACTIVE_STATE;
@@ -776,6 +774,8 @@ void meta_duplication_service::check_follower_app_if_create_completed(
776774

777775
// Once replica count is more than 1, at least one secondary replica
778776
// is required.
777+
std::vector<host_port> secondaries;
778+
GET_HOST_PORTS(pc, secondaries, secondaries);
779779
if (1 + secondaries.size() < pc.max_replica_count && secondaries.empty()) {
780780
query_err = ERR_NOT_ENOUGH_MEMBER;
781781
break;

‎src/meta/greedy_load_balancer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ bool greedy_load_balancer::all_replica_infos_collected(const node_state &ns)
153153
return false;
154154
}
155155

156-
config_context &cc = *ctx;
157-
if (cc.find_from_serving(n) == cc.serving.end()) {
156+
if (ctx->find_from_serving(n) == ctx->serving.end()) {
158157
LOG_INFO("meta server hasn't collected gpid({})'s info of {}", pid, n);
159158
return false;
160159
}

‎src/meta/server_state_restore.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,17 @@ void server_state::on_query_restore_status(configuration_query_restore_rpc rpc)
252252
const auto &r_state = app->helpers->restore_states[i];
253253
const auto &pc = app->pcs[i];
254254
host_port primary;
255-
std::vector<host_port> secondaries;
256255
GET_HOST_PORT(pc, primary, primary);
257-
GET_HOST_PORTS(pc, secondaries, secondaries);
258-
if (primary || !secondaries.empty()) {
256+
if (primary) {
259257
// already have primary, restore succeed
260258
continue;
261259
}
260+
261+
std::vector<host_port> secondaries;
262+
GET_HOST_PORTS(pc, secondaries, secondaries);
263+
if (!secondaries.empty()) {
264+
continue;
265+
}
262266
if (r_state.progress < response.restore_progress[i]) {
263267
response.restore_progress[i] = r_state.progress;
264268
}

‎src/replica/replica_context.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,16 @@ void primary_context::get_replica_config(partition_status::type st,
133133

134134
bool primary_context::check_exist(const ::dsn::host_port &node, partition_status::type st)
135135
{
136-
host_port primary;
137-
std::vector<host_port> secondaries;
138-
GET_HOST_PORT(pc, primary, primary);
139-
GET_HOST_PORTS(pc, secondaries, secondaries);
140136
switch (st) {
141137
case partition_status::PS_PRIMARY:
142138
DCHECK(pc.__isset.hp_primary, "");
139+
host_port primary;
140+
GET_HOST_PORT(pc, primary, primary);
143141
return primary == node;
144142
case partition_status::PS_SECONDARY:
145143
DCHECK(pc.__isset.hp_secondaries, "");
144+
std::vector<host_port> secondaries;
145+
GET_HOST_PORTS(pc, secondaries, secondaries);
146146
return utils::contains(secondaries, node);
147147
case partition_status::PS_POTENTIAL_SECONDARY:
148148
return learners.find(node) != learners.end();

0 commit comments

Comments
 (0)
Please sign in to comment.