The DTC uses the presumed abort two-phase commit protocol optimization. That is, if an enlisted transaction participant asks the DTC about a transaction and the DTC has no information, the enlisted participant assumes that the transaction has aborted. The DTC also supports the following two-phase commit optimizations:
Read-Only Commit Optimization
Delegated Commit Optimization
The DTC permits resource managers that can read but cannot update transaction-protected data to reply "read-only" at phase one. In this case, the transaction manager does not deliver the second phase notification to the resource manager.
The read-only optimization is also used between transaction managers to optimize the commitment of whole subtrees of the transaction tree. A transaction manager replies "read-only" if all of the resource managers and transaction managers subordinate to it reply "read-only." This signifies that this transaction manager and the entire subtree it controls need not receive notification at phase two of commit. Using this optimization eliminates the need for certain log writes and also allows for earlier release of locks on some resources.
The DTC permits commit coordinator responsibility to be delegated from the coordinating transaction manager to one of its subordinate transaction managers or resource managers. Commit coordinator delegation occurs when the coordinating transaction manager detects that only one subordinate resource manager or transaction manager is enlisted in the transaction.
The coordinating transaction manager delegates commit coordinator responsibility to the resource manager when both of the following two conditions are true:
No subordinate transaction manager is enlisted in the transaction.
Only one resource manager is enlisted in the transaction.
In this case, the coordinating transaction manager sets fSinglePhase when invoking the ITransactionResourceAsync::PrepareRequest method at phase one. This instructs the resource manager that it should act as the transaction coordinator.
The DTC delegates commit coordinator responsibility to the subordinate transaction manager when both of the following two conditions are true:
No resource manager is enlisted in the transaction with the current coordinating transaction manager.
Only one subordinate transaction manager is enlisted in the transaction.
In this case, the coordinating transaction manager sends a "delegated commit" message in place of the phase one message. The "delegated commit" message transfers commit coordinator responsibility from the current coordinating transaction manager to its subordinate transaction manager. This optimization is applied recursively. A transaction manager that receives commit coordinator responsibility may delegate commit coordinator responsibility to its subordinate transaction manager or resource manager. Using this optimization eliminates the need for certain log writes and also allows for earlier release of locks on some resources.