Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There are many variations of two-phase commit to handle special transaction communications patterns. We discuss three of them here: reinfection, where a transaction revisits a resource manager after the two-phase commit protocol has started; transfer of coordination, to allow one resource manager to execute one-phase-commit; and phase zero, where a transaction delays sending updates to some resource managers until after it has finished executing.
There are also many optimizations of two-phase commit to save messages and reduce the number of eager log writes. The most obvious is to avoid two-phase commit altogether when there is only one resource manager in a transaction, and run one-phase commit instead. This is a fairly important optimization since many transactions access only one resource manager. If a transaction issues Start and Commit but never accesses a resource manager, then it can run no-phase commit. That is, the coordinator can commit immediately without sending a message to any outside agent. Several other optimizations are described later: presumed abort, to reduce the amount of logging for transactions that abort; reducing a round of messages for read-only resources; and the cooperative termination protocol, to increase the chance that a blocked resource manager can become unblocked.