Transaction Manager's Role in Transactions
Updated: July 19, 2016
Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista
The transaction manager creates transaction objects and manages their atomicity and durability. Applications request the creation of a transaction object by calling the transaction manager's BeginTransaction method. When a resource manager first participates in a transaction, it calls the Enlist method to enlist in the transaction. The transaction manager tracks all the resource managers who enlist in the transaction. One of the following three results can occur:
The application either commits or aborts the transaction.
A resource manager aborts the transaction.
A failure occurs.
When asked to commit a transaction, the transaction manager initiates the two-phase commit protocol. During the first phase, it asks all enlisted resource managers to prepare. During the second phase, the transaction manager informs the resource managers whether the transaction committed or aborted.
The transaction manager maintains a log in storage on disk. The log is a sequential file that records transaction events. The transaction manager records transaction starts, enlistments, and commit decisions in the log. During normal processing, the transaction manager only writes to the log. However, if the transaction manager fails, it reads the log when it restarts to reconstruct the most recent state, using the log to make its state durable.