Hold the write until it wakes up — hinted handoff and the hint TTL
Hinted handoff lets a coordinator absorb a short replica outage by stashing missed writes locally and replaying them when the replica returns — but only within a TTL.
Partitions are dramatic; the everyday case is a single replica blipping for a few seconds — for that the cluster has a softer trick.
Scene 10
Hold the write until it wakes up
- Watch
- Try it
- Predict
- Capture
Replica E just went DOWN. Watch the simulated outage clock tick — for every missed write, the coordinator stashes a hint envelope. The age meter creeps toward the 3h TTL. Within TTL, the envelope replays when E returns; past it, the envelope dissolves.
Highlighted lines are the ones running in the diagram right now.
def put(key, value):replicas = ring.replicas_for(key)for r in replicas:if r.alive:send_async(r, Write(key, value))else:# stash on local disk for later replayhint_store.append(Hint(target=r, write=(key, value),created_at=now()),)return Ack # to W replicas (best-effort hints)
def replay_on_return(replica):for hint in hint_store.for(replica):age = now() - hint.created_atif age <= max_hint_window_in_ms:send(replica, hint.write)hint_store.remove(hint)else:# past TTL — replica returns 'stale forever'hint_store.remove(hint)
# runs continuously on the coordinatordef sweep():for hint in list(hint_store):age = now() - hint.created_atif age > max_hint_window_in_ms:hint_store.remove(hint) # silent losssleep(hints_flush_period_ms)
Where this sits in Build a wide-column store (Cassandra / DynamoDB family)
Scene 10 of 13, in the Healing act — Hinted handoff + read repair + anti-entropy + gossip keep the cluster honest.. When a replica is briefly unreachable, the coordinator stashes the write and replays it on return.
Up next. Hints expire and replicas drift cold; the cluster needs a way to find and fix divergence on its own.
All 13 scenes in Build a wide-column store (Cassandra / DynamoDB family) · Every curriculum