The commit service and the application program

The role of the commit service is to be a single place of record that helps the application decide whether the transaction should be committed or aborted.

If the Adaptive Servers are all prepared to commit, the application notifies the commit service to mark the transaction as committed. Once this happens, the transaction is committed despite any failures that might subsequently happen.

If any Adaptive Server or the application program fails before the prepare transaction statement, the Adaptive Server will rollback the transaction.

If any Adaptive Server or the application program fails after the prepare but before the commit, the Adaptive Server will communicate with the server functioning as the commit service and ask it whether to rollback or commit.

If the Adaptive Server cannot communicate with the server functioning as the commit service, it will mark the user task process as infected in Adaptive Server. At this point, the System Administrator can either kill the infected process immediately, or wait until communication to the commit service is restored to kill the infected process.

To decide whether or not to kill the infected process immediately, the System Administrator must consider the estimated downtime of the commit service, the number and importance of locks held by the infected process, and the complexity of the transaction in progress.

The role of the application program is to deliver the Transact-SQL statements to the Adaptive Servers in the proper order, using the proper DB-Library routines. The role of the commit service is to provide a single place where the commit/rollback status is maintained. The Adaptive Servers communicate with the commit service only if a failure happens during the two-phase commit.

The commit service needs its own DBPROCESS, separate from the DBPROCESSes used for the distributed transaction, to perform its record-keeping. Note, however, that the server handling the commit service can also be one of the servers participating in the transaction, as long as the commit service has its own DBPROCESS. In fact, all the servers involved in the transaction can be one and the same.