How can two workers end up holding the same lease after a failover, when each of them won a conditional create?
answer
- an acknowledgement is not a count of machines
- the promoted copy never held the write
- both creates succeed for the right reason
- stores differ on when they acknowledge
basics
~20 sThe first claim was acknowledged by a node that failed before any copy held the write. The promoted copy has no such key, so the second worker's conditional create succeeds — and neither worker is told.
solid answer
~50 sA conditional create tells you one thing: the node that answered had no such key and now does. It does not tell you how many machines hold that write. Where a store acknowledges as soon as the receiving node has applied it, losing that node before a copy has the write means the promotion produces a keyspace in which the claim never existed — so the second worker's create succeeds for exactly the right reason. Nothing notifies the first worker, and nothing warns the second that it is the second. Stores in this class genuinely differ here: some acknowledge only once a copy holds the write, and some let you ask for that per call, so the size of the window is a property of the deployment. Narrowing it is possible; closing it is a consensus problem that lives outside this tier.
go deeper
The takeaway is that a successful write can still disappear if the machine holding it is lost before anything else has a copy of it. A claim is a write like any other.
Explain the ordering: create acknowledged, node lost, copy promoted without the write, second create succeeds. Then say why no message reaches either worker.
Ask what an acknowledgement means in this deployment before answering, and name the lever — waiting for a copy to hold the claim — along with the latency and availability it costs.
Price the post-failover period in which some jobs run twice, decide whether that is survivable, and place the real guard accordingly rather than tuning the claim.
## The write that was acknowledged and then was never there The lease recipe rests on one assumption that reads as innocuous: that a successful **conditional create** — a write that succeeds only if the key is absent — means the claim exists. On a single node that is true. Once the tier has copies, the acknowledgement answers a narrower question than the one you asked. It says *the node I talked to had no such key and now holds one*. It does not say how many machines hold it. Put the two facts together and the failure writes itself: 1. Worker A's conditional create is accepted by the node it reached, which answers success. 2. Before that write is on any copy, the node is lost — hardware, host, network, a process killed. 3. A copy is promoted. Its keyspace is the state it had, which does not include A's claim. 4. Worker B attempts the same conditional create against the promoted node. The key is absent, so the create succeeds, correctly. 5. Both workers are now running the job, and both believe they hold the claim. ## Why nobody is told There is no mechanism in this shape that could tell them. The first worker is not waiting on the store; it is running a job. A claim is a passive entry, not a subscription, so there is nothing for the store to deliver even if it knew — and it does not know, because the node that accepted the claim is gone along with the knowledge that it did. The second worker sees an absent key and cannot distinguish *never claimed* from *claimed on a machine that no longer exists*. Renewal does not help either: the first worker's renewals now land on the promoted node, where they find either nothing to extend, or, with a blind renewal, the second worker's claim. ## What genuinely varies between stores This is one of the places where treating one product's behaviour as the model produces a wrong answer: - Some stores in this class acknowledge a write as soon as the receiving node applies it, and copies follow behind. The window is then real on every write. - Others will not acknowledge until at least one copy has the write, either as a deployment-wide posture or as something the caller can request for a particular write. - Some deployments have no copies at all, in which case there is no failover and no promotion — the whole keyspace is simply gone and the claim goes with it, which is a different failure with the same practical result. So the right answer to "how big is this window?" is a question back: what does an acknowledgement mean in this deployment? ## Things that do not help | Proposed fix | Why it does not address this | |---|---| | A longer lifetime on the claim | The claim is absent, not expired; its remaining lifetime is irrelevant to a node that never saw it | | Renewing more often | Renewals cannot reach a node that never held the claim, and blind ones may extend the other worker's | | A holder token on the claim | Protects the release from freeing somebody else's claim; both workers still hold valid, distinct claims | | Writing the claim under two key names | Both writes travel the same path and are lost together | ## What does narrow the window Waiting for at least one copy to hold the claim before treating the create as successful is the honest lever, where the store offers it. It costs latency on every claim and it makes the claim's availability depend on a copy being reachable, which is a trade a team should make deliberately. And it narrows rather than closes: the copy that acknowledged can be the one that is lost, and a promotion decided without agreement among the survivors can still pick a node that never had the write. A guarantee that exactly one worker holds a claim across a failure is a consensus and leader-election problem, and it is not solved by an entry in a volatile tier. ## What to do with that Two practical consequences follow. First, size the blast radius honestly: after a failover, expect a period in which some jobs run twice, and make sure that period is survivable rather than surprising. Second, if the job has an effect that must not happen twice, the claim is not the guard — the guard lives where the effect is made durable, and the claim is there to keep the common case cheap. One related disappearance is worth naming because it looks identical from the worker's side: where the tier is configured to remove entries once it reaches its memory ceiling, a live claim can be removed before its deadline, on a perfectly healthy node. The symptoms are the same — an absent key, a successful create by somebody else, nobody told — which is a good reason to keep claims out of a keyspace that is allowed to shed entries under pressure.
- Does waiting for a copy to hold the claim make a single holder guaranteed?No — it narrows the window, it does not close it. The copy that acknowledged can itself be the one that is lost, and a promotion decided without agreement among the survivors can still select a node that never received the write. A real guarantee of one holder is a consensus and leader-election problem, and it lives outside this tier.
- What other disappearance can remove a live claim, with the same symptoms?Removal under memory pressure. Where the tier is allowed to drop entries once it reaches its memory ceiling, a claim that is still in force can be removed on a healthy node, and the holder learns nothing. From the worker's side it looks identical to the failover case, which is a good argument for keeping claims out of a keyspace that sheds entries under pressure.
- How should a team observe how often this actually happens?Count the releases and renewals that find a different holder token, tagged by job identity, and compare them against failover events. Those refusals are the only cheap in-band evidence that a claim went missing while its holder was still working, and they distinguish a mis-sized lifetime from a topology event once you line them up on a timeline.
saying these in an interview costs you the question
- Believes an acknowledged write is already on every copy
- Assumes promotion preserves whatever the old node had accepted
- Thinks a longer lifetime protects a claim from a failover
- Expects the store to tell the first worker its claim has gone
- Treats waiting for a copy as a guarantee of a single holder