The two-phase commit protocol
The two-phase commit protocol is a process involving z/OS® Resource Recovery Services (RRS) and the resource manager that ensures that updates made to a set of resources by an application program are either all made or none made.
The application program decides whether to commit its changes to the resources; this commit is made to RRS, which polls all of the resource managers as to the feasibility of the commit call. Each resource manager votes whether to commit the updates. This is called phase 1 of the two-phase commit protocol.
After RRS has gathered the votes, phase 2 begins. If all votes are to commit the updates, then the phase 2 action is to commit; otherwise, phase 2 results in a backout of the updates. System failures, communication failures, resource manager failures, or application program failures are not barriers to completing the two-phase commit protocol.
- A unit of recovery is a unit of work that spans one commit (synchronization) point to the next commit point.
- Units of recovery are termed inflight between the time they are created (or the previous sync point) until the resource manager votes to commit the updates. If the resource manager fails while units of recovery are inflight, the resource manager backs out all of the database updates on the subsequent start.
- Units of recovery are termed indoubt between the time when the resource manager votes to commit the updates and the time when the sync-point manager calls the resource manager to do the commit. If IMS fails while units of recovery are indoubt, IMS holds the database updates until they are resolved.