Two-phase commit routines

The following routines make up the two-phase commit service:

Routine

Description

Page

abort_xact

Tells the commit service to abort the transaction.

§

build_xact_string

Builds a name string for use by each participating Adaptive Server for its begin transaction and prepare transaction statements. This string encodes the application’s transaction name, the commit service name, and the commid.

§

close_commit

Closes the connection with the commit service.

§

commit_xact

Tells the commit service to commit the transaction.

§

open_commit

Opens a connection with the commit service. The routine is given the login ID of the user initiating the session and the name of the commit service. It returns a pointer to a DBPROCESS structure used in subsequent commit service calls.

§

remove_xact

Decrements the count of servers still participating in the transaction.

§

start_xact

Records the start of a distributed transaction and stores initial information about the transaction (DBPROCESS id, application name, transaction name, and number of sites participating) in a lookup table on the commit server. It returns the commid identifying number for the transaction.

§

Two additional routines are used for ongoing status reports:

Routine

Description

Page

scan_xact

Returns the status of a single transaction or all distributed transactions.

§

stat_xact

Returns the completion status of a distributed transaction.

§

During the course of a session, the diagnostic routines scan_xact and stat_xact are used to check that the commit service carried out the request.

The scan_xact routine uses the commit service lookup table, spt_committab, which holds the following values:

The two-phase commit routines call internal stored procedures (for example, sp_start_xact) that are created in each server’s master database. The installmaster script creates the commit service lookup table and stored procedures in each server’s master database, for use whenever that server becomes a commit server.