Skip to content

Commit

Permalink
Merge pull request #276 from Yriuns/improve-election
Browse files Browse the repository at this point in the history
reduce election time cost for brand new cluster when leader lease enabled
  • Loading branch information
PFZheng committed Apr 14, 2021
2 parents e7776cd + cc74835 commit 575aaca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/braft/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ int NodeImpl::init(const NodeOptions& options) {
<< " init_meta_storage failed";
return -1;
}
// first start, we can vote directly
if (_current_term == 1 && _voted_id.is_empty()) {
_follower_lease.reset();
}

// init replicator
ReplicatorGroupOptions rg_options;
Expand Down

0 comments on commit 575aaca

Please sign in to comment.