Skip to content
Snippets Groups Projects
Unverified Commit 351c15fd authored by Manish R Jain's avatar Manish R Jain
Browse files

Avoid leader change in case of a node rejoining the cluster by using PreVote.

parent 85fc758c
No related branches found
No related tags found
No related merge requests found
...@@ -74,14 +74,23 @@ func NewNode(rc *intern.RaftContext, store *raftwal.DiskStorage) *Node { ...@@ -74,14 +74,23 @@ func NewNode(rc *intern.RaftContext, store *raftwal.DiskStorage) *Node {
MaxSizePerMsg: 256 << 10, MaxSizePerMsg: 256 << 10,
MaxInflightMsgs: 256, MaxInflightMsgs: 256,
Logger: &raft.DefaultLogger{Logger: x.Logger}, Logger: &raft.DefaultLogger{Logger: x.Logger},
// We don't need lease based reads. They cause issues because they require CheckQuorum // We don't need lease based reads. They cause issues because they
// to be true, and that causes a lot of issues for us during cluster bootstrapping and // require CheckQuorum to be true, and that causes a lot of issues
// later. A seemingly healthy cluster would just cause leader to step down due to // for us during cluster bootstrapping and later. A seemingly
// "inactive" quorum, and then disallow anyone from becoming leader. So, let's stick to // healthy cluster would just cause leader to step down due to
// default options. Let's achieve correctness, then we achieve performance. Plus, for // "inactive" quorum, and then disallow anyone from becoming leader.
// the Dgraph servers, we'll be soon relying only on Timestamps for blocking reads and // So, let's stick to default options. Let's achieve correctness,
// achieving linearizability, than checking quorums (Zero would still check quorums). // then we achieve performance. Plus, for the Dgraph servers, we'll
// be soon relying only on Timestamps for blocking reads and
// achieving linearizability, than checking quorums (Zero would
// still check quorums).
ReadOnlyOption: raft.ReadOnlySafe, ReadOnlyOption: raft.ReadOnlySafe,
// When a disconnected node joins back, it forces a leader change,
// as it starts with a higher term, as described in Raft thesis (not
// the paper) in section 9.6. This setting can avoid that by only
// increasing the term, if the node has a good chance of becoming
// the leader.
PreVote: true,
}, },
// processConfChange etc are not throttled so some extra delta, so that we don't // processConfChange etc are not throttled so some extra delta, so that we don't
// block tick when applyCh is full // block tick when applyCh is full
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment