Removing the block
Three phase commit, or 3PC, extends two phase commit with an extra round so a single coordinator crash does not leave participants blocked. It inserts a pre commit phase between voting and committing.
The three phases
- Can commit the coordinator asks if everyone can commit. Participants reply yes or no but do not yet lock in.
- Pre commit if all said yes, the coordinator sends pre commit. Participants acknowledge and now know the decision will be commit.
- Do commit the coordinator tells everyone to commit.
The pre commit phase makes the outcome recoverable. If the coordinator dies, a participant that reached pre commit knows the group agreed to commit and can drive the decision forward with the others.
The catch
3PC is non blocking only under a synchronous network with reliable failure detection.
- It assumes bounded message delay and detectable crashes.
- Under network partitions it can still make inconsistent decisions, which is why production systems prefer consensus protocols like Paxos or Raft.
Key idea
Three phase commit adds a pre commit round so participants can finish a decision without the coordinator, but it only stays non blocking under synchronous, partition free assumptions.