20200616

@ShiKaiWi

Plan

2h for Raft paper.

Notes

Questions

  1. What will happen when a separate node reconnects(means it may carray a very large term number) to the raft cluster?
  2. How to roll back the sent log when fail to persist that log locally or on another node?
  3. How to ensure that only one master exists at any time?
  4. In which order for commit log locally and replicate log remotely?
  5. 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.
  1. 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.

  2. How the consistency check handle the follower has a newer and more complete logs than leader?

  3. 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

  1. committed log: replicated in a majority of the cluster.
  2. match index: index of highest log entry.
  3. 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.

More