20200616
Plan
2h for Raft paper.
Notes
Questions
- What will happen when a separate node reconnects(means it may carray a very large term number) to the raft cluster?
- How to roll back the sent log when fail to persist that log locally or on another node?
- How to ensure that only one master exists at any time?
- In which order for commit log locally and replicate log remotely?
- What is the meanning for
committed log entry? Two definitions:
- The log entry is safe to apply to state machine.
- The log entry has been replicated across a majority of cluster.
What to in an consistency check? First, this check is done by follower with a tuple (index, term) from leader as input. Secondly, if no such entry is found in the local log the follower will respond to leader with failed checking. Finally, a brand new leader can use this check to find the lastest log entry where the two logs(of leader and follower) agree.
How the consistency check handle the follower has a newer and more complete logs than leader?
How to prove Leader Completeness? Leader Completeness: if a log entry is committed in a given term, then that entry will be present in the logs of the leaders for all higher-numbered terms.
Leader Completeness: commited log will always keep committed.
Proof: For 5 nodes cases, If the elected leader does not contains a commited log(replicated at least 3 nodes), then such node wont be elected as leader.
Misc
- committed log: replicated in a majority of the cluster.
- match index: index of highest log entry.
- after receive command from client: append entry to local log, replicate the log entry to a majority of cluster, update the committed index, apply the log to state machine and then update the last applied index.