22 Raft 3 Catch-up Follower
Catching-up Followers
A server in cluster goes down, miss a lot of AppendEntry, rejoin cluster, leader sends another AppendEntry, cannot just append, need to make sure append in order - correctness
How to make sure?
1. Leader sends
- Entry to add new log
prevLogIndex, index of previous log entryprevLogTerm, term of previous log entry
2. Server rejects to append if
- don't agree on
prevLogIndexorprevLogTerm
3. If leader got rejected
- decrease
prevLogIndexby 1 send again - until follower accept
This mechanism works because of Log Matching Property
- If two entries in different logs have the same index and term, then they store the same command.
- If two entries in different logs have the same index and term, then the logs are identical in all preceding entries.
Example
rejected
AppendEntries

Leader
-1toprevLogIndex, follower still reject

Leader
-1again, now follower accept

follower applies the
AppendEntries
