-
Notifications
You must be signed in to change notification settings - Fork 195
Description
Add leader leases based on the LeaseGuard protocol (Davis et al., SIGMOD'26). This enables linearizable local reads without per-read network round trips by exploiting Raft's Leader Completeness guarantee.
Why
The current option for linearizable reads is expensive: the leader contacts a majority before each read, adding one RTT of latency to every read operation.
Leader leases allow the leader to serve reads locally while holding a valid lease. Prior lease protocols for Raft are poorly specified, entangle leases with elections, delay failover recovery, and have been buggy across implementations (etcd, HashiCorp Raft, Consul).
LeaseGuard solves these problems:
-
The log is the lease: Committing a log entry grants the leader a lease. No separate lease-extension messages. This also solves the "faux leader" problem where a leader with disk failure keeps renewing its lease but can't make progress.
-
Decoupled from elections: No changes to voting. A node bound by a lease can still become leader with a higher term.
-
Formally specified: TLA+ spec available and model-checked for Read Your Writes and other correctness properties.
-
Fast failover via two optimizations:
- Deferred-commit writes: New leader accepts and replicates writes immediately, defers marking them committed until old lease expires. Prevents thundering herd.
- Inherited lease reads: New leader identifies "limbo region" (entries that might not be committed) and serves reads immediately for keys unaffected by limbo entries. Requires synchronized clocks with known error bounds.
Changes
- Add
lease_durationconfiguration option - Track
last_commit_timeon leader (updated when entry commits) - Add lease validity check before serving local reads
- On leader transition: infer prior leader's lease expiry from log, implement deferred-commit and inherited-lease-read logic
- Optional: require bounded clock error for inherited lease reads optimization
References
- Paper: https://arxiv.org/abs/2512.15659
- TLA+ spec: https://github.com/muratdem/RaftLeaderLeases/blob/main/TLA/leaseGuard.tla
- LogCabin implementation: https://github.com/mongodb-labs/logcabin/tree/leaseguard
- Python simulator: https://github.com/muratdem/RaftLeaderLeases/tree/main/Python