Try
↑ ↓ move↵ openesc close
In this lesson · topic 7 of 7
  1. 1. The lock that lies
  2. 2. Leases and fencing tokens
  3. 3. Trusting storage against token storage
  4. 4. What a 5-second lease and a clock check buy
  5. 5. When the lock's safety depends on the clock
  6. 6. Sessions, jeopardy and sequencers in a production lock service
  7. 7. Check the stale write

Topic 7

Check the stale write

4 min read

Predict first

A client checks that its lease is valid, then writes. Why can the write still be stale?

Predict first

Where must a fencing token be checked?

Predict first

A team uses a distributed lock so that only one worker rebuilds a cache at a time. Two workers occasionally both rebuild it. Does this lock need fencing?

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

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms