pinotto
pinotto

Reputation: 55

Increment term in Raft algorithm?

i'm trying to learn the raft algorithm to implement it, i don't have understood when the term is incremented, apart from when a node pass from stato follower to state candidate there are others cases when the term is incremented? For instance when the leader increment the last commit index? Thanks

Upvotes: 0

Views: 309

Answers (1)

msantl
msantl

Reputation: 391

If you're looking from a standpoint of a single peer in the Raft cluster, you will update your term if:

  • you receive a RPC request or response that contains a term higher than yours (note here that if you're in the leader mode, you also need to step down as a leader and turn to follower)
  • you're in the follower mode and didn't hear from the current leader in the minimum election timeout time (you'll be switching to candidate mode)
  • you're in the candidate mode and didn't get enough votes to win the election and the election timeout elapses

Generally observing the system, the term will be increased only when a new election starts.

Upvotes: 1

Related Questions