Try
↑ ↓ move↵ openesc close

Curriculum · Module 05, Consensus and Coordination

Lesson 3 · 7 topics · 40 min · Intermediate · 0/7 done

Locks, leases and fencing

A distributed lock expires, its holder does not notice, and storage pays. What a fencing token fixes and what it cannot.

What each topic covers

  • A client holds a valid lock, stalls, loses it without noticing, and writes anyway. Every part did its job and the data is still wrong.
  • How a lease is granted and expires, what a stalled holder sees, and why a growing number checked at storage closes the gap.
  • Run the same clients and the same stalls against storage that trusts the lock and storage that checks a token.
  • The measured corruption, what a longer lease and a careful clock check buy, and what fencing does not fix.
  • Why a lock that is safe only if clocks, networks and pauses behave is a different thing from one that is safe regardless, using a five-node majority lock as the example.
  • How Chubby keeps one session lease alive with KeepAlives, what a client does when the lease lapses during a failover, and how its sequencer and lock-delay protect servers.
  • Three quick checks on stale writes after a lease check, where a token is verified and when a lock needs fencing, plus the papers behind the lesson.

Topics

  1. 1The lock that lies4 min
  2. 2Leases and fencing tokens6 min
  3. 3Trusting storage against token storage7 min
  4. 4What a 5-second lease and a clock check buy5 min
  5. 5When the lock's safety depends on the clock7 min
  6. 6Sessions, jeopardy and sequencers in a production lock service7 min
  7. 7Check the stale write4 min

Practise this lesson

14 interview questions on locks, leases and fencing, with worked answers and sources.

Practise these

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