Skip to content

Commit

Permalink
machine not registed should response leader address
Browse files Browse the repository at this point in the history
  • Loading branch information
darionyaphet committed Feb 28, 2022
1 parent 43f2131 commit 11abc6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,13 @@ void MetaClient::getResponse(Request req,
}

auto&& resp = t.value();
if (resp.get_code() == nebula::cpp2::ErrorCode::SUCCEEDED) {
auto code = resp.get_code();
if (code == nebula::cpp2::ErrorCode::SUCCEEDED) {
// succeeded
pro.setValue(respGen(std::move(resp)));
return;
} else if (resp.get_code() == nebula::cpp2::ErrorCode::E_LEADER_CHANGED) {
} else if (code == nebula::cpp2::ErrorCode::E_LEADER_CHANGED ||
code == nebula::cpp2::ErrorCode::E_MACHINE_NOT_FOUND) {
updateLeader(resp.get_leader());
if (retry < retryLimit) {
evb->runAfterDelay(
Expand All @@ -766,11 +768,9 @@ void MetaClient::getResponse(Request req,
FLAGS_meta_client_retry_interval_secs * 1000);
return;
}
} else if (resp.get_code() == nebula::cpp2::ErrorCode::E_CLIENT_SERVER_INCOMPATIBLE) {
} else if (code == nebula::cpp2::ErrorCode::E_CLIENT_SERVER_INCOMPATIBLE) {
pro.setValue(respGen(std::move(resp)));
return;
} else if (resp.get_code() == nebula::cpp2::ErrorCode::E_MACHINE_NOT_FOUND) {
updateLeader();
}
pro.setValue(this->handleResponse(resp));
}); // then
Expand Down
3 changes: 2 additions & 1 deletion src/meta/processors/BaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class BaseProcessor {
GraphSpaceID spaceId = kDefaultSpaceId,
PartitionID partId = kDefaultPartId) {
resp_.code_ref() = code;
if (code == nebula::cpp2::ErrorCode::E_LEADER_CHANGED) {
if (code == nebula::cpp2::ErrorCode::E_LEADER_CHANGED ||
code == nebula::cpp2::ErrorCode::E_MACHINE_NOT_FOUND) {
handleLeaderChanged(spaceId, partId);
}
}
Expand Down

0 comments on commit 11abc6d

Please sign in to comment.