LightMySky
En anglais

Distributed Transactions and the Blocking Case of Two-Phase Commit

A transaction spanning several stores needs one atomic decision. Two-phase commit gets it by making participants promise before the coordinator decides, and its known weakness is that a coordinator failure at the wrong moment leaves participants holding locks with nobody to ask.

Commence ce sujetPas besoin de compte. La progression est enregistrée dans ce navigateur.

Ce que l'enfant saura faire ensuite

  • Walk both phases and say what a participant has promised once it votes yes
  • Identify the window where a coordinator failure blocks the participants
  • Say how running consensus on the commit decision removes the blocking case, and what it costs

1 · Lis

Linearizability makes copies of one object act as one. A transaction over several stores asks for something different: one outcome, commit everywhere or abort everywhere. Phase one: the coordinator asks every participant to prepare, and each votes yes or no. A yes vote is a promise: I will obey your decision, and I hold my locks until you tell me. A lock keeps other transactions off the data until released.

Try it together

One order lives in two stores. The coordinator asks both. Both vote yes, so the coordinator sends commit and both commit. Had one voted no, the coordinator would send abort and both would drop the change. The decision is one; the stores just obey it.

The blocking window opens once a participant votes yes: it can no longer decide alone, because another store may already hold a commit order from the coordinator. If the coordinator crashes in that window, yes-voters wait with locks held and nobody can answer them. A crash before anyone voted yes is harmless, since every store can abort.

Consensus lets machines agree on one value by majority. Running it on the decision removes the single decider: the replicas agree among themselves on commit or abort, so the survivors can finish as long as a majority is still up. The price is extra rounds of messages on every commit, not just when something breaks.

Yes means obey and wait; a dead coordinator in that window leaves voters blocked.

Lesson, quiz and flashcard text written for this dataset and revised in the P25 source pass.

2 · Regarde

En anglais

Sans écran

Imprimer une fiche d'exercicesFormat A4, avec une page de corrigés pour les adultes. Sans écran, sans internet.

Où se situe ce sujet

Puis s'entraîner

8 questions attendent derrière cette leçon, chacune avec sa réponse expliquée. Chaque réponse nourrit le ciel : les étoiles s'allument à mesure qu'elles sont apprises, et pâlissent quand vient le moment de revenir.

Commence ce sujet