
I implemented Raft, a KV store, and a sharded system in Go (MIT 6.5840)
I recently completed the labs from MIT 6.5840 Distributed Systems and implemented everything in Go, including:
- Raft consensus algorithm
- A replicated Key/Value store
- A sharded KV system with dynamic reconfiguration
The implementation focuses a lot on concurrency and failure handling:
- goroutines for RPC handling and background tasks
- channels for coordination between Raft and the state machine
- dealing with unreliable networks (dropped / delayed / out-of-order RPCs)
Some interesting challenges:
- ensuring commitIndex never goes backward under out-of-order RPC responses
- handling retries safely with client/request IDs (idempotency)
- keeping deduplication state consistent across snapshots and shard transfers
I wrote a detailed README explaining both the design and the tricky edge cases I encountered.