Distributed

Lesson 03.10

Two-phase commit

Two-phase commit makes several databases commit or abort one transaction together: a coordinator asks each to prepare, then tells them all the final decision.

Both, or neither

Ava is booking a school trip. She needs the bus and the museum: a bus with no museum, or a museum with no bus, is useless. So she asks both to hold a slot, and only says “go!” when both are ready.

Once they say “ready”, they have to wait for Ava. What if Ava's tablet dies right then?

In this lesson you'll

  1. 1Watch a booking where nothing goes wrong.
  2. 2Guess what happens when Ava's tablet dies halfway.
  3. 3Find a way that never gets stuck or half-booked.