3. Planning Your Replication Scheme : Replication Scheme Design Issues : Collision Design : How Collisions Are Caused
 
Share this page                  
How Collisions Are Caused
A collision is an event that occurs when simultaneous changes are made in two different databases to rows with identical keys. The Replicator Servers detect this collision condition when the data is transmitted between the two databases.
In a collision condition, Ingres Replicator cannot synchronize the databases without destroying information.
There are five possible situations that cause collision between a source and target database. Collisions can occur during an insert, update, or a delete transaction and is detected in these instances:
Insert transaction detects a duplicate key.
Update transaction is attempted on a record that no longer exists.
Update transaction is attempted on a record that does not match the original.
Delete transaction is attempted on a record that no longer exists.
Delete transaction is attempted on a record that does not match the original.
Note:  If you use referential integrity constraints in a distributed environment, you create collision-like conflicts that cannot be resolved. For example, assume a customer record is deleted in one database while at the same time a new order for that customer is entered in a different database. If there is a referential constraint requiring orders to reference existing customers, there is an exception when the order is replicated back to the first database.
The best defense against a collision is prevention. Design your replication system to reduce the probability of collisions. Even in well-designed databases, collisions can occur during a system failure when it becomes necessary to switch between replicated databases. For this reason alone, you need to plan how to handle collisions in your replication system.