Distributed locks and fencing
Two copies of a job both think they hold the lock on the same file, and both write to it. The lock service did nothing wrong. One of them was simply paused for a few seconds at the worst moment. How do you stop it?
In this lesson you'll learn to
- Explain what a distributed lock is for, and the difference between locks for efficiency and locks for correctness.
- Explain why distributed locks expire, and how a paused holder can outlive its lock.
- Use fencing tokens so that storage rejects writes from an expired lock holder.
- Choose between a Redis lock, a consensus-backed lock, and avoiding the lock altogether.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.