LESSON 06 · Detection and handoff

Serve through temporary failure

Failure suspicion, substitute replicas, and recovery each need a plan.

SYSTEM VIEW

The storage path

Diagram view
Write acks—
Hints—
B holds—

Watch a replica go quiet, a substitute keep its writes, and the hint come home ten minutes later.

  1. Each node periodically swaps what it knows with a few random peers; Cassandra gossips every second with up to three. A and C don’t pick each other this round, yet A learns C is up through B. No central registry holds the list.

    Gossip
    every second (Cassandra)
    Peers
    up to three a round

    What changed

    • Heartbeats A ↔ B ↔ C
    • A knows C is up
  2. B’s next heartbeat never reaches A, though C still hears it. One miss is suspicion, not proof: a long garbage-collection pause, a slow link or an overloaded machine looks the same. Nodes wait for several observations and a timeout before routing around B.

    A saw
    1 missed heartbeat
    C saw
    B up

    What changed

    • A suspects B
    • C still hears B
  3. B goes down. With a sloppy quorum the Coordinator counts a healthy substitute: it writes v2 to A and to Substitute C, which tags its copy as a hint for B. A and C ack, W = 2 is met, and the Client sees ok.

    Preferred
    A and B (N = 2)
    Acked by
    A and C

    What changed

    • B down
    • v2 on A
    • Hint for B on C
    • Client told ok
  4. Ten minutes later B is back up at v1. A read with R = 1 reaches B and returns v1: W + R = 3 is more than N = 2, yet the read misses the acknowledged v2, because C took it, not B.

    B back
    after 10 min, at v1
    W + R
    2 + 1 = 3 > N = 2
    Read got
    v1 from B

    What changed

    • B back up, still v1
    • Read returns v1
  5. Gossip tells C that B is up again, so C hands over the write it kept for B: v2 of order:42. B now holds v2 like A, and C drops its copy. Hints falls to 0.

    Handed off
    v2, C → B
    C keeps
    no copy

    What changed

    • B holds v2
    • C’s copy for B
  6. Replay B’s outage. Sloppy quorum: A and C ack v2, then C fails and the hint is lost, so B returns at v1 and needs anti-entropy repair. Strict quorum: only A and B count, so the put fails and no read misses an acknowledged write.

    Sloppy quorum
    ok; hint lost or expired
    Strict quorum
    put fails while B is down
    Cassandra
    hints don’t count to W

    What changed

    • B’s outage replayed from v1
    • Quorum: sloppy or strict
    During B’s outage

Space plays · ← → step · Home resets

THE IDEA

How it works

Nodes can share membership and heartbeat observations through gossip: each node periodically swaps what it knows with a few random peers, so news spreads through the cluster without a central registry. Cassandra, for example, gossips every second with up to three peers. One missed heartbeat is suspicion, not proof: slow links, long garbage-collection pauses, and overloaded machines can look dead. Use multiple observations and appropriate timeouts, then update routing without a single membership dependency.

A sloppy quorum lets healthy substitute nodes count when preferred replicas are unreachable. In hinted handoff, the substitute stores a temporary copy tagged with its intended owner and sends it back after recovery. Here is the sequence, with preferred replicas A and B (N = 2) and W = 2. B goes down. The coordinator writes to A and to substitute C, which notes that the copy belongs to B. A and C acknowledge, so the client sees success. Ten minutes later B returns, and C hands over the write and drops its copy.

This helps availability, but weakens fixed-set quorum reasoning. In that sequence, W + R > N holds with R = 1, yet a read that reaches B before the handoff returns the old value. Hints can also expire or be lost with the substitute, so they cannot be the only repair process. Dynamo popularized this pair. Cassandra stores hints too, but does not count them toward a normal quorum. If a read must see every acknowledged write, turn sloppy quorums off and let the write fail during the outage.

DECISION POINT

A preferred replica is gone for hours and the substitute holding hints also fails. What assumption breaks?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Failure detection is uncertain under delay.
  • Hints bridge temporary outages; they do not replace durable repair.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 2
ApplyQUESTION 01

A node misses one heartbeat during a long garbage-collection pause. What should its peers do?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 2 checkpoints answered correctly to complete this lesson.