Hey everyone,
I'm not able to reach a final conclusion as multiple sources are giving me
slightly contradicting information.
This paragraph from the paper (copied verbatim) suggests that followers update
current term
> To prevent this problem, servers disregard RequestVote RPCs when they
believe a current leader exists. Specifically, if a server receives a
RequestVote RPC within the minimum election timeout of hearing from a current
leader, it does not update its term or grant its vote. This does not affect
normal elections, where each server waits at least a minimum election timeout
before starting an election. However, it helps avoid disruptions from re- moved
servers: if a leader is able to get heartbeats to its cluster, then it will not
be deposed by larger term numbers.
*it does not update its term* suggests that in other occasions, the follower
does increment its term.
follower's term when a request_vote RPC is received.
I cant find a specific line in the paper where it says it should be.
The spec doesn't update follower's term.
\* Server i receives a RequestVote request from server j with
\* m.mterm <= currentTerm[i].
HandleRequestVoteRequest(i, j, m) ==
LET logOk == \/ m.mlastLogTerm > LastTerm(log[i])
\/ /\ m.mlastLogTerm = LastTerm(log[i])
/\ m.mlastLogIndex >= Len(log[i])
grant == /\ m.mterm = currentTerm[i]
/\ logOk
/\ votedFor[i] \in {Nil, j}
IN /\ m.mterm <= currentTerm[i]
/\ \/ grant /\ votedFor' = [votedFor EXCEPT ![i] = j]
\/ ~grant /\ UNCHANGED votedFor
/\ Reply([mtype |-> RequestVoteResponse,
mterm |-> currentTerm[i],
mvoteGranted |-> grant,
\* mlog is used just for the `elections' history variable for
\* the proof. It would not exist in a real implementation.
mlog |-> log[i],
msource |-> i,
mdest |-> j],
m)
/\ UNCHANGED <<state, currentTerm, candidateVars, leaderVars, logVars>>
Reply contains `mterm |-> currentTerm[i],`, Ie the follower's term, and
`currentTerm` is in the UNCHANGED set.
I checked a popular implementation (andrewjstone/rafter) and it does update the
state as well. See here
Score is 1 vs 3 now. Who wins? :)
--