Resynchronization for federated systems
Federated two-phase commit includes an automatic process that attempts to handle errors during commit transactions.
Besides errors on the federated server, a federated environment increases the potential for errors that result from network, communications, or data source failures.
To ensure data integrity, the federated server handles these errors during the federated two-phase commit process:
- First phase error
- If a database communicates that it has failed to prepare to commit a unit of work, the federated server rolls back the unit of work during the second phase of the commit process. During the second phase, the federated server sends a rollback message to all participating data sources that are waiting for the transaction outcome.
- Second phase error
- Error handling at this phase depends upon whether the second phase commits or rolls back the transaction. The second phase only rolls back the transaction if the first phase encountered an error.
If one of the participating data sources fails to commit or rollback the unit of work, possibly due to a communications failure, the federated server retries the commit or rollback through a process called resynchronization. Resynchronization is initiated and managed by the federated server automatically. The calling application is informed that the commit was successful through the SQLCA (SQL communications area) if the application connects to the federated server through a two-phase commit connection. The calling application is disconnected from the federated server if the application connects to the federated server through a one-phase commit connection.
Most data sources are not capable of initiating resynchronization if a failure occurs in a federated system. The federated server initiates the resynchronization process.
In certain circumstances, a federated server might fail during transaction processing, for example, due to a power failure. Resynchronization usually resolves any distributed unit of work transactions without intervention.
Resynchronization attempts to complete all indoubt transactions. As part of normal resynchronization, the resynchronization agent connects to the resource manager database for a transaction and issues a commit or rollback decision. The federated transaction manager then propagates that decision to the data sources that participated in the distributed unit of work transaction.