Resolving Conflicts During Synchronization

In synchronization, or two-way mirroring mode, the assumption is that changes will be made to both tables involved in the replication, and the changes may be different in each table. The goal of synchronization, then, is to make sure that both tables are kept up to date with one another by applying changes from table A to table B and changes to table B to table A.

If you choose synchronization, as your replication type, you should be prepared to handle the situation where changes have occurred at the same time on the same record in both tables involved in the replication. For example, if the respective transaction logs show, at the same mirroring interval, that the Price field in a Product record is updated on SQL Server and also updated on Db2/400, you need to decide which update is applied to both tables. By default, the changes made to the table in the database defined as the source connection are propagated to the table in the target database.

After defining your replication using the Replication wizard, or Multiple Replications wizard, go to the Preferences tab in the Replication Properties dialog to specify how conflicts should be handled:

  • SourceServerWins: This is the default value. Changes applied to the table defined in the source connection are also applied to the table defined in the target connection(s), overriding any changes that have occurred in the target connection table.

  • TargetServerWins: Changes applied to the tables defined in the target connections are also applied to the table defined in the source connection, overriding any changes that have occurred in the source connection table. This option also requires you to set a priority for the target tables involved so that, if changes occur in more than one target table, Syniti DR can determine which changed value to use. Set the priority for target connections as follows.

  1. In the Metadata Explorer, select the group.

  2. From the right mouse button menu, choose Group Properties.

  3. In the Group Properties dialog, go to the Preferences tab.

  4. Click in the Conflict Resolver Priority field to view the target connections.

  5. Order the target connections by selecting the connection, then using the up and down arrows to determine its priority.

    • FirstComeWins: The timestamps of the changes in the tables designated as source and target are compared and the change that applied earliest is applied to all tables.

    • LastComeWins: The timestamps of the changes in the tables designated as source and target are compared and the change that applied last is applied to all tables.

    • Use Script: This option generates an event that can be handled by writing a function Replication_onConflict. The script editor can be accessed from the General Tab Use Script option. You can write a function that handles the values from each table in any way you wish using VB .NET.

NOTE: In the rare case that foreign key values are updated when synchronization has been defined, the synchronization algorithm may not work and may cause foreign key constraint violation issues. Please contact our support team via the Help Center if you need to modify foreign key values for replications with synchronization.