Optimisation: Candidate can possibly retry on request vote if request delivered on lower currentTerm
ktoso opened this issue · comments
This:
case Event(msg: RequestVote, m: ElectionMeta) if msg.term > m.currentTerm =>
log.info("Received newer {}. Current term is {}. Revert to follower state.", msg.term, m.currentTerm)
as @colin-scott mentioned, perhaps could be improved to try again after becoming:
perhaps you should forward the RequestVote message instead of dropping it?
e.g.
m.clusterSelf forward msg goto(Follower) using m.forFollower(msg.term)
This optimization can be applied in a bunch of places. Basically, whenever any nodes receives a message that has a higher term, it should forward that message to itself before transitioning to a new term.