Earliest Timestamp Conflict Detection and Resolution

Columns with names of the form CDRTS$ column group and CDRTS$ROW are used to contain timestamps that reflect modification times for column groups and the row.

Note:

Tables with $ or $$ symbols are internal or hidden tables.

The DBMS_GOLDENGATE_ADM includes the following procedures for configuring earliest and latest timestamp resolution:

  • ADD_AUTO_CDR()

  • ADD_AUTO_CDR_COLUMN_GROUP()

  • REMOVE_AUTO_CDR()

  • REMOVE_AUTO_CDR_COLUMN_GROUP()

  • ALTER_AUTO_CDR()

  • ALTER_AUTO_CDR_COLUMN_GROUP()

The field ADDITIONAL_OPTIONS in both ADD_AUTO_CDR() and ALTER_AUTO_CDR() turn on the use of earliest timestamp. Turning on earliest timestamp automatically turn on versioning, which adds a new hidden column KEYVER$$ (version number) of type timestamp. A new flag value is added to indicate the earliest timestamp usage. This field is also added to the DELETE TOMBSTONE table. Delete conflicts are the reason that version number is needed. With an earliest timestamp resolution, delete conflicts, which can be transparent, might not only incorrectly succeed, they might prevent new inserts of the row (new versions). With a version timestamp, the delete can be correctly resolved against a row DML for the same row version.

The original insert of the row receives the current timestamp from its default value. The delete of this row then inserts the version number and the time when this row was inserted, into the tombstone table when there is a delete. On a new insert, by default, the version number receives the current timestamp again, thereby avoiding a false conflict with the present delete entries in the tombstone table.

Example

Assume that you have a table tab1 which is globally consistent between databases on site 1 and site 2. The table contains a (primary) key. ACDR is automatically maintaining a key version (kv) and timestamp (ts) as columns for the base table (hidden) and the tombstone table. For key version kv and timestamp ts

Database 1: insert tab1 key1 kv1 ts1

Database 2: delete tab1 key1 kv1 ts1

Insertion to DELETE TOMBSTONE table key1 kv1 ts1

Database 1: insert tab1 key1 kv2 ts2

Without using the key version, the insert would be ignored, the delete timestamp is earlier. As the key version is used, you know that kv2 is not the version of the row that was deleted and the insert succeeds.