“…After that, the LogRequestMsg message is packed with a whole bunch of information related to log characteristics as well as the new entries and is sent to the follower node that the follower node will use to update its log. In Algorithm 5, when the LogRequestMsg message to update log is received at the follower node from the Rep-licateLogMsg function; it first compares the argument variable term with its presentTerm if the argument passed value is greater, then it updates its term to the latest term, (1) on initialization do (2) presentTerm � 0; votedForNode � null; log � < > ; committedLength � 0 (3) presentRole � follower; presentLeader � null (4) votesReceived � { }; sentEntriesLength � < > ; ackedEntriesLength � < > (5) end (6) on recovery from crash do (7) presentRole � follower; presentLeader � null (8) votesReceived � { }; sentEntriesLength � < > ; ackedEntriesLength � < > (9) end (10) on node nodeId suspects leader has failed, or on selection timeout do (11) if logOk ∧ termOk then (7) presentTerm � candidateTerm; presentRole � follower; votedForNode � candidateId (8) msg � (VoteRequestMsg, candidateId, candidateTerm, candidateLogLength, candidateLogTerm) (9) kNodes � kRandomNodes ⊂ nodes (10) for each node ∈ kNodes send (11) msg to node (12) end (13) send (VoteResponseMsg, nodeId, presentTerm, true) to node candidateId ( 14) else (15) send (VoteResponseMsg, nodeId, presentTerm, false) to node candidateId ( 16) end (17) end (18) end ALGORITHM 2: Voting on a new leader, at FOLLOWER side. 16 Computational Intelligence and Neuroscience resets its votedForNode variable to null, converges to "follower" state, and updates its presentLeader variable with the new leader.…”