Skip to content

Commit

Permalink
do not check term for leader info by default para (#5096)
Browse files Browse the repository at this point in the history
Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
  • Loading branch information
liwenhui-soul and Sophie-Xie committed Dec 26, 2022
1 parent 82184aa commit 6857e88
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/meta/ActiveHostsMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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 @@ -45,14 +46,16 @@ nebula::cpp2::ErrorCode ActiveHostsMan::updateHostInfo(kvstore::KVStore* kv,
TermID term = -1;
nebula::cpp2::ErrorCode code;
for (auto i = 0U; i != leaderKeys.size(); ++i) {
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 (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;
}
}
}
// write directly if not exist, or update if has greater term
Expand Down

0 comments on commit 6857e88

Please sign in to comment.