Real two-phase commit is much more complex than what's presented here, unfortunately. We have to guarantee that all processes either succeed or fail, which the pseudocode here does not do:
- If the transaction manager is interrupted, we have no consistency.
- If something fails while committing one process, any previously committed processes cannot be rolled back.
- A rollback can fail (e.g. loss of db connection)
- Retry logic is not discussed.