Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. Half of a transfer
  2. 2. Prepare, then commit
  3. 3. Crash a coordinator and count the locks
  4. 4. The coordinator that does not come back
  5. 5. Which timeout is safe
  6. 6. Three phases, and why teams skip them
  7. 7. Votes, blocking and timeouts

Topic 3

Crash a coordinator and count the locks

8 min read

What the lab runs

Two transactions arrive each tick. Each asks every participant to vote. With a small chance a participant votes no. With a chance you set, the coordinator crashes after collecting yes votes, and its participants are left holding locks until it recovers.

Thirty percent of the transactions touch one hot row. If a stuck transaction holds the lock on it, a new transaction that wants the row is turned away. That count is how you see the damage.

Predict before you press play

You raise the coordinator crash chance from 0 to 5 percent. What changes first?

tick 1503 participants, Wait for the coordinatorchance all vote yes: 94%

Transactions

started
300
committed
227 (76%)
aborted by a no vote
12
coordinator crashes
14

Each transaction asks every participant to prepare, then commits only if all voted yes. A coordinator that crashes after the votes leaves its participants holding locks.

The cost of an in-doubt transaction

stuck now
2
turned away by locks
59 (19.7%)
longest lock hold
30 ticks
average lock hold
3.4 ticks
split outcomes
0

A transaction that touches the hot row while a stuck one holds its lock is turned away. A participant that aborts on its own, after the timeout, may disagree with a coordinator that had already chosen commit.

Stuck transactions over the last 120 ticks
Stuck transactions over the last 120 ticks. Text version available below the chart.035810161120recent ticksstuck

Full-page version with guided experiments: Two-phase commit lab.

Things to try

  1. Set coordinator crash to 0 and read how many are turned away.
  2. Set it to 5 and raise the downtime to 90 ticks.
  3. Choose to ask the other participants and compare the stuck count.
  4. Choose to abort after a timeout and read the split outcomes.
  5. Raise participants to 8 and read how the commit share falls.

The full-page lab has a guided experiment for each of these.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms