Which timeouts are safe in two-phase commit, and which are not?
Sketch your own answer first, then compare it with the one below.
A strong answer
Before a participant votes, it can abort alone after a timeout. No one can have committed without its yes, so this is safe.
The coordinator can also abort when a vote does not arrive. Nobody has been told to commit yet.
After a participant votes yes, a timeout is not a license to abort. The coordinator may have decided commit and told someone else. An abort by this participant would split the outcome, which is the one thing the protocol exists to prevent. The safe moves are to keep waiting, ask the coordinator, or ask peers.
Sources
- Philip A. Bernstein, Vassos Hadzilacos, Nathan Goodman (1987). Concurrency Control and Recovery in Database Systems.
- Dale Skeen (1981). Nonblocking commit protocols.