Implementing Raft (Hands-On)

In Progress


  • The labrpc module is used to simulate a lossy network between peers.
  • Your Raft instances must interact only with RPC; for example, they are not allowed to communicate using shared Go variables or files.

  • How is this modeled? Each peer in a separate process or goroutine (or something else)?

Part 2A

Task: Implement Raft leader election and heartbeats (AppendEntries RPCs with no log entries). The goal for Part 3A is for a single leader to be elected, for the leader to remain the leader if there are no failures, and for a new leader to take over if the old leader fails or if packets to/from the old leader are lost. Run go test -run 2A to test your 2A code.

  • Use go test -run 2A to run a series of automated tests against my implementation.
  • Be sure you pass the 2A tests before submitting Part 2A, so that you see something like this:
    $ go test -run 2A
    Test (2A): initial election ...
      ... Passed --   4.0  3   32    9170    0
    Test (2A): election after network failure ...
      ... Passed --   6.1  3   70   13895    0
    ok      raft    10.187s