Platform SDK: Transaction Server

Performing Recovery

The recovery process is actually comprised of two steps. In the first step, the resource manager resolves all in-doubt transactions. In the second step, the resource manager lets the transaction coordinator know that it has completed recovery and, therefore, has no more transactions in-doubt. The resource manager performs the following actions:

  1. Examines the log file to identify all the prepare information records for transactions that are in-doubt. For each such transaction, it invokes the IResourceManager::Reenlist method. This method (via an out parameter), provides the outcome for that transaction. If the Distributed Transaction Coordinator (MS DTC) doesn't know the outcome of the transaction, then the Reenlist method will fail with an XACT_E_REENLISTTIMEOUT error message. In this case the resource manager will need to retry at a later time.
  2. Invokes the IResourceManager::ReenlistmentComplete method when the resource manager learns the outcome to all the in-doubt transactions. This method completes the recovery and also informs the MS DTC that the resource manager has no more in-doubt transactions. By invoking this method, the resource manager guarantees that it will not invoke the Reenlist method again. It is not correct for an RM to ask the outcome of a transaction by invoking the Reenlist method once it has invoked the ReenlistmentComplete method.

Note It is not necessary for a resource manager to resolve all in-doubt transactions before it enlists in new transactions. Step 1 can be performed at any time after the resource manager establishes a relationship with MS DTC. Step 2 can be repeated multiple times without affecting the outcome of transactions. A resource manager can invoke the IResourceManager::Reenlist method for the same transaction multiple times. However, once step 2 has been performed, step 1 can't be performed again.