Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 02 · System Design · When the stalls must agree · about 19 min to read

Watch: Distributed transactions: the two ledgers must agree
▶ VideoPlay it as a journeyTutor comes with a plan

The Two Ledgers Must Agree (Distributed Transactions)

The Two Ledgers Must Agree
The Two Ledgers Must Agree · Open board

The last board of the System Design distributed-data arc. It picks up the line that Splitting the ledger (sharding) left hanging: “NO EASY CROSS-BOOK TXN.”

Before you start. Splitting the ledger (sharding) cut the chai stall’s single ledger into two books, so two boys could write at once, each book holding half the names. That is all you need here: two books, two pens, and a boy who can walk off with his book mid-sentence.

Lesson 9 of 115 in System Design

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • The transfer that ends with 100 rupees nowhere
  • 1978: two-phase commit, ask everyone before anyone writes
  • The crack in it: blocking, a wait nobody inside can end
  • 1987: the saga, give up all-or-nothing and buy an undo
  • Why the undo runs backwards
  • The retry that pays twice, and the word that stops it
  • The cheapest answer: put both names in the same book

Terms it explains: coordinator, participant, prepare, commit, two-phase commit, lock, blocking, saga, compensating transaction, idempotent, shard, shard key, 100 unaccounted for, 13 blocked moments, transfer happened twice, Orchestration, Choreography.

Lab

One transfer, two books, and a crash that lands between them. Where does the money end up?

Drag Which step of the protocol dies across all seven steps on each tab, and read the verdict under The bill.

Open The two ledgers must agree

Related papers

Review System Design