barge
barge copied to clipboard
Log Compaction
Design Proposal:
- Leader detects that the nextEntry is not in it's log and sets 'contains_snapshot' field on next AppendEntries RPC request.
- Follower reads the 'contains_snapshot' field and transitions to a Follower' state.
- Follower initiates a pull of the snapshot form the Leader (over HTTP for a first cut, pluggable transport later)
- Follower' services AppendEntries RPC calls in a speculative manner, accepting all entries assuming the snapshot has been applied.
- No entries are committed until the snapshot is downloaded and applied
- After the snapshot is downloaded and applied Follower' applied the commits and transitions back to Follower
Looks good to me. If it makes it easier, for my use case I'm going to put the snapshots on S3 (or Swift); my guess is that is fairly common. You may want to assume a 'shared filesystem' abstraction, starting with a simple File backed implementation, and then you don't have to add the HTTP replication logic just yet.
That's almost exactly the case I was thinking of when I mentioned making this pluggable. Maybe I should make sure that gets in first and I can provide the File backed implementation first and then a bunch of add-ons later.