00 /What You Will Learn
By the end you will be able to
- Explain why a distributed lock alone cannot guarantee safety when clients can pause for garbage collection or disk stalls.
- Use Martin Kleppmann's fencing token to make the database the final authority that rejects delayed writes.
- Acquire a lock and monotonic token together in Redis using an atomic Lua script.
- Enforce the fencing check in PostgreSQL with a guarded
UPDATE ... WHERE last_fencing_token < token. - Explain why Redlock without fencing tokens cannot prevent split-brain overwrites at the database layer.
Before you start
Finish Lab 06 (Redis Basics) and Lab 08 (Race Conditions) first. You should know what a TTL is and how uncoordinated concurrent writes corrupt data. Docker Desktop and Python 3 are needed.