Distributed Transactions and the Blocking Case of Two-Phase Commit · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

Two phases, one atomic decision

Computing · Data & Databases · ages 22-24
Name ______________________   Date ____________
  1. One participant votes no. What is the outcome?

    • Commit everywhere
    • Abort everywhere
    • Commit where voters said yes
  2. What are the two phases of the protocol?

    • Commit first, then ask permission
    • Prepare and vote, then decide and obey
    • Lock everything, then unlock everything
  3. A participant that voted yes must keep its locks until the coordinator answers.

    Circle one:   True   False

  4. All stores voted yes and the coordinator sends abort. What do they do?

    • Obey and abort, since yes promised obedience
    • Commit anyway, since all votes were yes
    • Vote again until the answer is commit
  5. The coordinator collects yes votes from all three stores, then crashes before sending anything. What happens?

    • The stores wait, blocked, with locks held
    • Each store commits on its own
    • Each store aborts on its own
  6. Why is a yes-voter forbidden from timing out and aborting alone?

    • Timeouts are not allowed in the protocol
    • Aborting alone is always slower
    • The coordinator may already have told others to commit
  7. The coordinator crashes. Which moment leaves participants unblocked?

    • After collecting yes votes but before deciding
    • After sending commit to some stores only
    • Before any store voted yes
  8. Lee says running consensus on the decision keeps commit just as cheap. What is the mistake?

    • Consensus removes the need for any vote
    • Survivors still cannot finish without the coordinator
    • Every commit pays extra message rounds
LightMySky · lightmysky.comW1-mt_MP_B_a_EwW-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Two phases, one atomic decision W1-mt_MP_B_a_EwW-s1

  1. Abort everywhere · A single no forces one shared abort.
  2. Prepare and vote, then decide and obey · Votes come first; the single decision follows.
  3. True · That wait is exactly what the yes vote promised.
  4. Obey and abort, since yes promised obedience · Yes promised obedience, not a particular outcome.
  5. The stores wait, blocked, with locks held · Yes-voters cannot decide alone, and nobody can answer them.
  6. The coordinator may already have told others to commit · A lone abort could split the shared outcome.
  7. Before any store voted yes · With no yes cast, every store can safely abort.
  8. Every commit pays extra message rounds · Consensus buys liveness with messages on the happy path.
Worksheet · LightMySky