Platform SDK: Transaction Server

IResourceManager::ReenlistmentComplete

The resource manager calls ReenlistmentComplete after resolving all the in-doubt transactions it knows about.

HRESULT ReenlistmentComplete ();

Return Values

S_OK
Success.

E_INVALIDARG
One or more arguments are invalid.

E_OUTOFMEMORY
Unable to allocate memory.

E_UNEXPECTED
Something unexpected occurred.

XACT_E_CONNECTION_DOWN
Lost connection with the TM.

XACT_E_RECOVERYALREADYDONE
The ReenlistmentComplete method was called at least once after this interface was obtained. Therefore, the recovery is already complete.

Comments

This lets the Coordinator forget any transactions that it was remembering, as it had an obligation to remember those transactions until it was certain that the resource manager knew the outcome of those transactions. An RM will forget a transaction before responding to the second phase, this allows for a window in which an RM would have forgotten a transaction but not the TM. It is so because, the COMMITTED message from the RM to the Coordinator can get lost on its way due to some fault. A Coordinator would not know if the resource manager has received the COMMIT notification or not, unless it receives the COMMITTED message from the RM. Until it receives the COMMITTED message, it cannot forget the transaction. The RM when it reestablishes a relationship with the Coordinator will query the status for all the in-doubt transactions but it will not ask for the transactions that it had already forgotten. After resolving all the in-doubt transactions, it simply calls the IResourceManager::ReenlistmentComplete method which then lets the TM to forget the transactions.

This protocol lets the recovery process be repeated multiple times without affecting the outcome of transactions. Any number of failures such as crashes can occur during recovery, but the results will always be the same. This protocol also lets the resource managers enlist in new transactions while the in-doubt transactions are being resolved. The Coordinator is able to discern between the new transactions and the old transactions. New transactions are the ones that the RM enlists in from the point the new RM-Coordinator relationship is established, and all the old transactions are the ones that it had enlisted in prior to the establishment of the new relationship.