The Advantage TPS maintains database stability in the event of workstation or network failure. Should a workstation or the network fail during a transaction, a transaction that is being committed will finish to completion, and an uncommitted transaction will automatically be rolled back. If the file server crashes during a transaction, the Advantage TPS log files are used when the Advantage Database Server is reloaded to return the database to a known state.
The Advantage TPS uses the Read Committed Isolation Level to build robustness into database applications by only allowing visibility of committed data. While updates are being made within a transaction, the Advantage TPS hides those updates from other users until that data is committed. The uncommitted data is visible only to the application performing the transaction. The other applications view the data as it was before the transaction began. If the transaction is rolled back, the uncommitted data is never seen by any users other than the one who was performing the transaction. If the transaction is committed, the updated data becomes visible to all users at one time.
Automatic recovery of your database to a known state after a system failure is a key feature of the Advantage TPS. System failures in this context are server failures, such as operating system read or write errors. How the Advantage TPS handles system failures depends on what phase the transaction was in when the system failure occurred.
A transaction can be in one of three phases: the Build Phase, the Commit Phase, or the Rollback Phase. The Build Phase is active as insert, update, and delete operations are being issued by the application. These operations are logged to the transaction log file by the Advantage TPS during this phase. The Commit Phase occurs after the Advantage application issues a commit transaction statement. This signals the Advantage TPS to begin writing the database updates that are stored in the transaction log file to the tables and index files. The Rollback Phase occurs after the Advantage application issues a rollback transaction statement. This signals the Advantage TPS to abort all database updates that are stored in the transaction log file. The database is left exactly as it was before the transaction began.
If a system failure occurs during the Build Phase, the Advantage TPS aborts only the insert, update, or delete operation that was in progress. The database is left as it was before the individual operation occurred and the transaction remains in the Build Phase. An error is returned to the application indicating that the insert, update, or delete operation failed.
If a system failure occurs during the Commit Phase, the Advantage TPS puts the transaction into the Rollback Phase. The entire transaction is aborted (rolled back). The database is left as it was before the transaction began and the transaction is complete. An error is returned to the application indicating the transaction was rolled back.
If a system failure occurs during the Rollback Phase, a failed transaction results. The tables and index files associated with the transaction will be left in a temporarily unstable state. An error is returned to the application indicating the transaction failed. The application needs to recognize this error and attempt a failed transaction recovery. While the Advantage Database Server is loaded/started, a failed transaction can be recovered from by calling the applicable Advantage client "failed transaction recovery" or "TPS cleanup" API. After the failed transaction recovery is completed, the database will be as it was before the transaction began. See your Advantage client-specific documentation for more information about the failed transaction recovery APIs.
Should a server crash due to a power outage, abend, or other critical errors while one or more applications are in the midst of a transaction, a failed transaction(s) will result. The tables and index files associated with the transaction(s) will be left in a temporarily unstable state. The Advantage TPS can recover from the failed transactions and return the tables and index files to a known state. After bringing the file server back up, reload/restart the Advantage Database Server. Loading/starting the Advantage Database Server automatically triggers failed transaction recovery. Any transactions that were in the Build Phase when the server crashed will be rolled back. Any transactions that were in the Commit Phase will continue with the commit. Any transactions that were in the Rollback Phase will continue with the rollback.
Always view the Advantage Database Server error log, ADS_ERR.ADT or ADS_ERR.DBF, to determine if the Failed Transaction Recovery was successful. If a Failed Transaction Recovery error is encountered, contact Advantage Technical Support. It is recommended that periodic server backups be a part of any disaster recovery plan.