Paths Subjects Questions Quizzes Pricing Search
Advanced Open Pro

Why a TTL Lock Isn't Enough

A batch job service uses a Redis lock (SET job:daily-export owner NX PX 30000) so only one worker runs the daily export at a time. Worker A acquires the lock and starts writing the export file to S3. A GC pause stalls Worker A for 45 seconds. Worker B acquires the lock (Worker A's lease expired) and starts its own export write to the same S3 key. Worker A then resumes and continues writing, unaware time has passed.

  1. Explain exactly why the TTL alone does not prevent both workers from writing.
  2. Introduce fencing tokens: what has to change at the lock service and at the storage layer (S3 writes) for this to be prevented?
  3. Does the Redlock algorithm (majority of independent Redis nodes) fix this problem? Explain the core objection.

Share this question

← Back to Distributed Transactions, Consensus & Coordination practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.