The log consistency check is currently implemented as follows:
/**
* Performs the "consistency check", which checks if the data that we just got from the
*/
def containsMatchingEntry(otherPrevTerm: Term, otherPrevIndex: Int): Boolean =
(otherPrevTerm == Term(0) && otherPrevIndex == 0) || (lastTerm == otherPrevTerm && lastIndex == otherPrevIndex)
I don't think the second disjunct is correct. The Raft paper states that the log consistency check should fail "if log doesn’t contain an entry at prevLogIndex whose term matches prevLogTerm".
The log consistency check is currently implemented as follows:
I don't think the second disjunct is correct. The Raft paper states that the log consistency check should fail "if log doesn’t contain an entry at prevLogIndex whose term matches prevLogTerm".
So I think the second disjunct should be:
(assuming 1-indexed log entries, following the raft paper)