In this lesson · topic 7 of 7
Topic 7
Check the stale write
4 min read
Predict first
Predict first
Predict first
Take away
- A lease fails safe when its holder dies and fails open when its holder is merely slow. The lease length chooses between those failure modes, it does not remove either.
- A client’s own lease check is a mitigation. A fencing token checked at the resource is the guarantee.
- A lock protects only what can compare tokens. For anything else, turn the token into a version, an idempotency key, or an atomic swap.
Sources
- Cary G. Gray and David R. Cheriton, Leases: an efficient fault-tolerant mechanism for distributed file cache consistency, ACM Symposium on Operating Systems Principles, 1989.
- Mike Burrows, The Chubby lock service for loosely-coupled distributed systems, USENIX Symposium on Operating Systems Design and Implementation, 2006.
- Martin Kleppmann, How to do distributed locking, 2016.
- Leslie Lamport, Time, clocks, and the ordering of events in a distributed system, Communications of the ACM, 1978.