Skip to main content

Short note: Distributed commit

Short answer

Distributed commit ensures all or none of the servers in a transaction perform the operation. A coordinator asks participants; one-phase commit cannot signal unilateral abort. Two-phase commit (2PC) collects votes then distributes the decision; it blocks if the coordinator fails after yes votes. Three-phase commit adds a pre-commit phase to be non-blocking; logs on stable storage enable recovery.

Write a short note on distributed commit.

Distributed commit (atomic commitment) is the problem of making all processes in a group perform an operation (commit) or none of them. It is the base of atomic distributed transactions, where a transaction updates data at several servers and must not end with some servers committed and some aborted.

A coordinator asks the participants if they can commit; the decision is commit only if every participant agrees.

  • One-phase commit: the coordinator tells everyone to commit or abort. A participant cannot tell the coordinator that it has had to abort (e.g. because of a deadlock), so this is not enough.
  • Two-phase commit (2PC): phase 1 collects votes (canCommit?/Yes-No); phase 2 distributes the decision (doCommit/doAbort). It blocks if the coordinator fails after participants voted Yes.
  • Three-phase commit (3PC): adds a pre-commit phase so participants can decide among themselves after a coordinator crash; non-blocking, but more messages.
Coordinator  Participants
  canCommit? ------>
        <------ Yes/No
  doCommit/Abort -->
        <---- haveCommitted

Logs on stable storage are used so crashed servers can complete the commitment after recovery.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 8 questions →