Parallel DSI processing must duplicate the commit order of transactions at the primary database, yet allow transaction updates to process simultaneously. It must then resolve any transaction contentions that occur as a result. Commit order deadlock transaction contentions—or contention deadlocks—can occur when a transaction cannot commit because it must wait for an earlier transaction to commit, and the earlier transaction cannot commit because needed resources are locked by the later transaction.
For example, DSI threads A and B are processing transactions in parallel. Thread A’s transaction must commit before thread B’s transaction. Thread B’s transaction locks resources needed by thread A. Thread B’s transaction cannot commit until thread A’s transaction commits, and thread A’s transaction cannot commit because needed resources are locked by thread B.
Replication Server provides two methods for resolving commit order deadlocks:
Internally, using Replication Server internal tables and a function string, or
Externally, using the rs_threads system table in the replicate database and several function strings.
The internal method is handled primarily within Replication Server, and uses the rs_dsi_check_thread_lock function string for commit order deadlock detection. The external method requires both Replication Server and the replicate database, and uses the rs_threads system table for both commit order validation and commit order deadlock detection.
Sybase recommends the internal method, which is the default, for both Sybase and non-Sybase data servers. This method requires less network I/O than the external method, and, if a commit order deadlock occurs, may require the rollback of only a single transaction. The external method requires more network I/O and results in the rollback of several transactions. The external method is included for compatibility with earlier versions of Replication Server.
If Replication Server encounters commit order deadlock and dsi_commit_control is on, Replication Server rolls back and retries one transaction. If, however, Replication Server encounters commit order deadlock and dsi_commit_control is off, Replication Server rolls back and retries all transactions serially.
To select a method, enter the alter connection command with the dsi_commit_control option. For example, to choose the internal method for the pubs2 database on the TOKYO_DS data server, enter:
alter connection to TOKYO_DS.pubs2 set dsi_commit_control to ‘on’
Setting dsi_commit_control to “on” specifies the internal method; setting dsi_commit_control to “off” specifies the external method.