Try
↑ ↓ move↵ openesc close
In this lesson · topic 6 of 7
  1. 1. Half of a transfer
  2. 2. Prepare, then commit
  3. 3. Crash a coordinator and count the locks
  4. 4. The coordinator that does not come back
  5. 5. Which timeout is safe
  6. 6. Three phases, and why teams skip them
  7. 7. Votes, blocking and timeouts

Topic 6

Three phases, and why teams skip them

4 min read

The idea

Three-phase commit adds a round between the vote and the commit. After all votes are yes, the coordinator sends a pre-commit message. Only when every participant has acknowledged it does the coordinator send the final commit.

The extra round gives a rule. No participant commits until all of them know the outcome will be commit. If the coordinator dies, the survivors can look at what state they are in, elect a new coordinator and finish, without waiting for the old one. This is the nonblocking commit protocol described by Skeen.

Why it is rarely used

It assumes that a late message means a crashed machine. A real network can delay or split. Two groups of participants can each time out, elect a coordinator, and reach different decisions. Then atomicity is gone, and that was the point of the whole protocol.

It also adds a round trip to every commit, in the common case where nothing goes wrong.

Systems that need a commit that does not block use a different design. They store the commit decision in a replicated log that survives the loss of a minority of machines. That is the route Gray and Lamport describe for transaction commit. Most others keep two-phase commit inside one database and use other patterns between services, which the next lesson covers.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms