PrepCity

Two-phase commit

Open the lab

By the last page, this is the design you will have built. Drag it, or Show all, to see every part.

Lesson · 13 pages · about 12 min

Two-phase commit

One transfer, two databases: commit on one and fail on the other and money vanishes. Two-phase commit makes both agree (prepare, vote, decide, finish), at the price of round trips, held locks, and blocking when the coordinator dies.

Words you’ll learn

  • Database
  • Shard
  • Service
  • Commit
  • Two-phase commit
  • Rollback
  • PostgreSQL
  • Prepared transaction
  • Disk
  • In flight

Page by page