Process Recovery
Process Recovery is an automatic recovery mode which restores a database to a consistent state after a process has crashed or been killed.
This recovery method is supported by Transaction Handling, if running on the database. When a failure occurs, it rolls back all changes in incomplete local transactions, restoring their Before images, so that the data is restored to the state that it was in before the incomplete transactions started.
Distributed Transactions
Recovery of processes using distributed transactions is handled by the MDTC.
In a distributed environment, failure can occur on the client, on the Reality server, or at any point on the network. Failures on the Reality server are of two types: process failure and system failure.
When a process fails:
- If the transaction branch has not been prepared, updates are rolled back, any locks taken are released, and the remote TM aborts the transaction.
- If the transaction branch has been prepared, it persists in that state - as do any locks taken on its behalf - even though the process itself may have terminated. When the MDTC initiates its automated recovery, it requests the transaction branch to either commit or roll back its transaction updates, effectively completing the transaction, and releasing all associated locks.
When a system failure occurs, Reality runs its standard transaction recovery phase, in which it scans the raw log and rolls back all uncompleted local transaction updates. During this period all Reality databases on the system are locked to all users. If the raw log contains any prepared distributed transactions, it is the responsibility of the MDTC to initiate and complete recovery of these outstanding transaction branches. When both local and distributed transactions have been resolved, the databases are released back to users.
If the MDTC itself fails, any outstanding prepared transaction branches will persist on the raw log until the MDTC restarts and connects to run the recovery process. This is known as cold recovery.
If the MDTC does not fail, it will connect to the Reality system immediately and start the recovery process. This is known as hot recovery.
When the MDTC connects to the Reality system to initiate the recovery, the connection is to the RXA server instead of to the SQL server as shown in the diagram in the topic Distributed Transactions. The RXA server provides the MDTC with details of all prepared transactions currently in the raw log. For each of these transactions, the MDTC issues a request to the RXA server to roll back or commit. When all of the rollback or commit operations have completed successfully, the MDTC closes the connection.
If the MDTC's automatic recovery process fails to complete, it is possible to carry out manual recovery of distributed transactions.