Distributed locks with Redis – Redis https://redis.io/topics/distlockredis
There is an obvious race condition with this model:ui
- Client A acquires the lock in the master.
- The master crashes before the write to the key is transmitted to the slave.
- The slave gets promoted to master.
- Client B acquires the lock to the same resource A already holds a lock for. SAFETY VIOLATION!