共用方式為


Transaction Manager's Role in Transactions

 

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:

  1. The application either commits or aborts the transaction.

  2. A resource manager aborts the transaction.

  3. A failure occurs.

The Commit and Abort methods can also be called on transaction objects.

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.

See Also

Application Programmer's View of Transactions
Commit Coordination
How Distributed Transactions Work
Resource Manager's Role in Transactions