Previous Topic

Next Topic

Collision Resolution

A collision in a replicated database occurs when changes are made to the same record in different databases participating in the same CDDS. In a collision condition, Ingres Replicator cannot synchronize the databases without destroying information. The Replicator Servers can detect this collision condition when the data is transmitted between the two databases. For more information, see Collision Design.

Previous Topic

Next Topic

Collision Detection

Suspected collisions in the Ingres Replicator system can be detected from these sources:

Previous Topic

Next Topic

Collisions in the Replication Server Log File

Because of the overhead involved, the Replicator Server by default does not look for collisions or attempt to resolve them. You can control collision detection and resolution through CDDS collision modes. If a collision does occur, the Replicator Server identifies the condition as an error. For example, the server issues errors such as:

The target record cannot be found in the target database or

or

A primary key was already in the target database for an insert transaction.

If you find these types of errors in the replicat.log file, this indicates a collision condition.

Previous Topic

Next Topic

Queue Collision Report

If you suspect that a collision has occurred, run the Queue Collision Report available through Visual DBA or the Resolver option of Replicator Manager. This option looks at the distribution queue of the source database to see if any collision conditions exist. The report displays problems that exist in the current distribution queue and its target databases. For more information, see Viewing Collision Conflicts in online help or Queue Collision Report.

Previous Topic

Next Topic

Methods to Handle Collisions

There are two ways to handle collisions—automatic or manual. Each method has advantages and disadvantages. Automatic resolution (using the Ingres Replicator collision mode settings) takes less time but can produce unexpected results. Manual resolution gives you more control and, in some cases, is the only way to resolve a conflict.

To resolve the condition, you must restore consistency to the base tables of the source and target database as well as to the replicated transaction keys in the shadow tables. Replication operations (insert, update, delete) that caused the collision must also be removed from the distribution queue.

Previous Topic

Next Topic

How You Resolve Collisions Manually

You can resolve collisions manually in the following ways:

Visual DBA: You can resolve collisions manually by expanding the Replication branch and expanding the branch of the desired database and clicking the Collisions tab. For more information, see the online help topic Resolving Collisions Manually.

Command Line: To resolve a collision manually, follow these steps:

  1. Determine the correct image of the record in collision that must be in the replicated system.
  2. Determine the replicated transaction key for the record.

    The key that you select must be the replicated transaction key of one of the records in collision.

  3. To correct the record, you need to temporarily disable the Change Recorder. To do this, issue a set trace point DM32.

    Note: This disables the Change Recorder for your session only.

  4. Update the record to be the correct image.
  5. Update the shadow record, giving it the selected replicated transaction key.
  6. Remove any replication commands from the distribution queue that cause this record to be in collision.
  7. Re-enable the Change Recorder by issuing a set notrace point DM32.
  8. Repeat Steps 1-6 for each database in the replicated system that is affected by the collision.

Previous Topic

Next Topic

Automatic Resolution of Collisions

With automatic resolution, when two records collide, one record prevails over the other. If the operation was an insert or an update, a record survives a collision by overwriting the record in the target database (the target row is deleted and the prevailing source row is inserted in its place). If the transaction was a delete, the record in the target database is deleted. If a record does not survive a collision, its replication operation (insert, update, or delete) for that target is removed from the distribution queue.

Note: Automatic resolution overwrites the entire record and can overwrite columns that have correct information with columns that do not have correct information. You must not use automatic resolution if the information contained in the losing record is important. For example, if your database contains documents that are continually updated with new information, you can lose information with automatic resolution.


© 2007 Ingres Corporation. All rights reserved.