ML Wiki
Machine Learning Wiki - A collection of ML concepts, algorithms, and resources.

Two-Phase Commit

Two-Phase Commit

A way to ensure consistency in a distributed system

Two Phases

; Phase 1

  • coordinator sends “prepare to commit” message
  • subordinates make sure they can do that no matter what happens
  • write the action to a Database Transaction Log to tolerate failures
  • subordinates reply with “ready to commit” message

; Phase 2

  • if all ready, send “commit”
  • if anyone fails, send “abort”

Example

Image

  1. Coordinator: update
  2. Coordinator: prepare to commit
  3. Subordinate: write to log
  4. Subordinate: say “ready”
  5. Coordinator: commit

See also

Sources