In this homework, you will build a distributed key-value store with two operations: GET and PUT. Data will be replicated across multiple follower servers to ensure data integrity, and a single leader server will coordinate actions across these follower servers. All nodes in this key-value store will utilize the Two-Phase Commit protocol.
Multiple clients (users) will communicate with a single leader server according to the given Key-Value gRPC API. The leader will forward all GET requests to a random follower. For PUT requests, the leader should follow the Two Phase Commit (2PC) protocol to ensure that:
(1) operations are performed atomically across multiple follower servers
(2) backup data is consistent across multiple follower servers
The leaders and the followers communicate over a bi-directional gRPC stream. The leader sends a Leader message, which the follower will process and respond with a Response message.
The staff solution for parts A and B combined make the following changes:
You may find it helpful to read through some of the pre existing code before you start implementing. Using Important Existing Code as a guide, we suggest that you read through:
KVStore and Journal
TPC Leader and TPC Follower
MessageManager
tpc.proto (pkg/tpc/rpc) and kv.proto (api)
TODO
Here is a list of things to do for this homework in the recommended order of completion at a high level - detailed specifications of Part A and Part B follow in the next pages.