0

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

pinotto
  • 45
  • 7

1 Answers1

1

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.

msantl
  • 371
  • 2
  • 6