rs_lastcommit table

Each row in the rs_lastcommit table identifies the most recent committed transaction that was distributed to the database from a primary database. Replication Server uses this information to ensure that all transactions are distributed.

The rs_lastcommit table should be updated by the rs_commit function string before the transaction is committed. This guarantees that the table is updated with every transaction Replication Server commits in the database.

Replication Server maintains the rs_lastcommit table as the maintenance user for the database. You must make sure that the maintenance user has all of the permissions needed for the table.

Table 6-2 lists the columns in the rs_lastcommit table.

Table 6-2: rs_lastcommit table structure

Column name

Datatype

Description

origin

int

An integer assigned by Replication Server that uniquely identifies the database where the transaction originated

origin_qid

binary(36)

The origin queue ID for the commit record in the transaction

secondary_qid

binary(36)

A queue ID for a stable queue used during subscription materialization

origin_time

datetime

Time at origin for the transaction

dest_commit_time

datetime

Time the transaction was committed at the destination

The origin_time and dest_commit_time columns are not required.

The origin column is a unique key for the table. There is one row for each primary database whose data is replicated in this database.

If you use a coordinated dump with the database, you should update rs_lastcommit with the rs_dumpdb and rs_dumptran function strings.

For Adaptive Server databases, the rs_commit, rs_dumpdb, and rs_dumptran function strings execute a stored procedure named rs_update_lastcommit to update the rs_lastcommit table. This is the text of that stored procedure:

/* Create a procedure to update the
 ** rs_lastcommit table. */
 create procedure rs_update_lastcommit
     @origin int,
     @origin_qid binary(36),
     @secondary_qid binary(36),
     @origin_time datetime
 as
     update rs_lastcommit
         set origin_qid = @origin_qid,
         secondary_qid = @secondary_qid,
         origin_time = @origin_time,
         commit_time = getdate()
     where origin = @origin
     if (@@rowcount = 0)
     begin
         insert rs_lastcommit (origin,
             origin_qid, secondary_qid,
             origin_time, commit_time,
             pad1, pad2, pad3, pad4,
             pad5, pad6, pad7, pad8)
         values (@origin, @origin_qid,
             @secondary_qid,@origin_time,
             getdate(), 0x00, 0x00, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00)
     end
 go

See the reference pages for the rs_commit, rs_dumpdb, and rs_dumptran functions in the Replication Server Reference Manual for more information.