1
votes

Suppose a network of 5 nodes uses RAFT consensus protocol. Each nodes maintains a transactions log which consists of a list of the log entries. Each log entry again consists of index and term. All of them are marked themselves as leader candidate and send the request Vote (term, index). The current log entries (i.e. list of term and index values) of all the leader candidate nodes as follows -

enter image description here

Then who will be the leader ?

1

1 Answers

0
votes

(It's been long enough that I think this won't be used for homework anymore.)

Working through the problem.

Which nodes can each vote for?

  • candidate1: {1, 4, 5}
  • candidate2: {1, 2, 3, 4, 5}
  • candidate3: {1, 3, 4, 5}
  • candidate4: {4}
  • candidate5: {1, 4, 5}

Looking at the above, any of candidates 1, 4, 5 can have a majority of votes so any of those can become the leader.

candidate4 is not necessarily going to be the new leader because one of the other two may get the promised votes before it does.

As a practical application, imagine that candidate4 was the leader of term 3 and then died. Either candidate 4 or 5 will pick up the baton and lead term 4.