Previous Topic: X/Open Distributed Transaction ProcessingNext Topic: User Exits


Two-Phase Commit Process

The Transaction Manager that is chosen to coordinate the commit of the distributed transaction is the one hosting the server application that begins the global transaction. As the server-to-server flows transmit between the CA Gen servers, a distributed transaction participant tree is built of all servers that are involved in the transaction. The server application that begins a global transaction is the server that commits or aborts the transaction.

Phase 1

Prepare—The first phase of a Two-Phase Commit involves the following actions:

  1. The coordinating TM sends prepare to commit message to every process involved in the transaction.
  2. A process returns a prepared message when it has determined validity of the work to be performed and can accomplish that work.
  3. It is guaranteeing that it can commit.
  4. It cannot decide to abort after preparing.
  5. If a process cannot prepare, it must abort.
  6. The process waits for permission to commit.
  7. If an abort message is received at any time, the process must abort.
Phase 2

Commit—The second phase of a Two-Phase Commit involves the following actions:

  1. The coordinating TM keeps track of prepared responses.
  2. If any process aborts, the coordinator sends an abort message to all processes, which must then abort.
  3. If all processes return the prepared response, the coordinator sends a commit message to all participants.
    • The processes receiving the commit message can now implement their part of the transaction.
    • The coordinator waits for all participants to acknowledge the commit.
  4. When all participants have acknowledged their commits, the coordinating TM marks the transaction complete.