Skip to content

Commit

Permalink
Revert "do not check term for leader info by default para (#5096)"
Browse files Browse the repository at this point in the history
This reverts commit 6857e88.
  • Loading branch information
critical27 committed Jan 17, 2023
1 parent 5015bc3 commit a909e09
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/meta/ActiveHostsMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
DECLARE_int32(heartbeat_interval_secs);
DEFINE_int32(agent_heartbeat_interval_secs, 60, "Agent heartbeat interval in seconds");
DECLARE_uint32(expired_time_factor);
DEFINE_bool(check_term_for_leader_info, false, "if check term when update leader info");

namespace nebula {
namespace meta {
Expand Down Expand Up @@ -46,16 +45,14 @@ nebula::cpp2::ErrorCode ActiveHostsMan::updateHostInfo(kvstore::KVStore* kv,
TermID term = -1;
nebula::cpp2::ErrorCode code;
for (auto i = 0U; i != leaderKeys.size(); ++i) {
if (FLAGS_check_term_for_leader_info) {
if (statusVec[i].ok()) {
std::tie(std::ignore, term, code) = MetaKeyUtils::parseLeaderValV3(vals[i]);
if (code != nebula::cpp2::ErrorCode::SUCCEEDED) {
LOG(INFO) << apache::thrift::util::enumNameSafe(code);
continue;
}
if (terms[i] <= term) {
continue;
}
if (statusVec[i].ok()) {
std::tie(std::ignore, term, code) = MetaKeyUtils::parseLeaderValV3(vals[i]);
if (code != nebula::cpp2::ErrorCode::SUCCEEDED) {
LOG(INFO) << apache::thrift::util::enumNameSafe(code);
continue;
}
if (terms[i] <= term) {
continue;
}
}
// write directly if not exist, or update if has greater term
Expand Down

0 comments on commit a909e09

Please sign in to comment.