Platform SDK: Transaction Server

Transaction Manager's View of Transactions

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 transaction manager Enlist method to enlist in the transaction. The transaction manager tracks all the resource managers who enlist in the transaction. One of 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. Then, during the second phase, the transaction manger informs the resource managers whether the transaction committed or aborted.

The transaction manager maintains a log in safe 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.

The transaction manager also provides an operator interface to manage transactions and maintains performance counters that can be displayed using the system performance monitor. The transaction manager records important operational events in the system log which can then be displayed using the system event viewer. The viewer has a graphical management interface that is integrated with the SQL Enterprise Manager. This interface lets the operator configure the system, view transactions, and abort or commit in-doubt transactions.