Raft Consensus Algorithm CS418 Assignment in Go from
Princeton University, COS-418: Distributed Systems, Mike Freedman and Kyle Jamieson. Includes lecture on Raft (PPTX) and programming assignments to build a Raft-based key-value store. (Fall 2016, ...)
See also Raft Github for more.
-
The code is intentionally jumbled up and there are a lot of unnamed goroutines.
-
The src folder also contains MapReduce Golang.
My interpretation is based on Producer-Consumer concept.
Incoming requests and heartbeat timers are producers and consumers are logic that work on those products (E.g Sending RPCs, appending logs, ...). There are a lot of channels being used due to this concept. If I were to re-write, I wil use mutexes and global state to synchronise the logic flow.
There are some instances that locks are not used on shared resources because they are segregated by the Leader and Follower state. (Eg. logs).
- How to implement Leader-Append-only guarantee?.
- What is 'prevLog' as mentioned in the paper. Is it the last log of old entries, or the last log of newer entries?
- How to handle committed logs? If two RPCs are sent, one is for index 2-4 (A), and the other 5-7 (B). If both (A) and (B) are received by the followers and replied, what if reply (B) reaches the Leader first followed by reply(A)?
- Defining 'majority'.
// More to be added.