Oracle7 Server Distributed Systems Volume II: Replicated Data

Contents Index Home Previous Next

Selecting a Conflict Resolution Method

The symmetric replication facility's declarative conflict resolution mechanism provides system-defined routines for resolving update and uniqueness conflicts.

These system-defined routines do not support the following situations:

For these situations, either provide your own conflict resolution routine or determine a method of resolving these errors after they are logged in the DefError view.

System-Defined Resolution Routines for Update Conflicts

The table below specifies the system-defined resolution methods for update conflicts that guarantee convergence in three types of replication environments.

Any Number of Master Sites (4 methods) One or Two Master Sites (9 methods) One Master Site and Multiple Snapshots Sites (12 methods)
latest timestamp
additive
minimum value (always decreasing)
maximum value (always increasing)
earliest timestamp
minimum value
maximum value
highest priority site
highest priority value
average
discard from snapshot sites
overwrite master site
Table 6 - 1. System Defined Methods to Resolve Update Conflicts

Note: The conflict resolution methods you assign need to ensure data convergence and provide results that are appropriate for how your business uses the data.

System-Defined Resolution Routines for Unique Constraint Conflicts

The symmetric replication facility provides three methods for resolving uniqueness conflicts:

Avoiding Ordering Conflicts

If you have more than one master site, none of these routines result in convergence, and these routines should only be used in conjunction with a notification facility. See the Conflict Notification section [*].

If your replicated environment has more than two masters:

Table 6 - 2 shows how having three master sites can lead to ordering conflicts. Master Site A has priority 30; Master Site B has priority 25; and Master Site C has priority 10; x is a column of a particular row in a column group that is assigned the site-priority conflict resolution method.

Note: The highest priority is given to the site with the highest priority value. Priority values can be any Oracle number and do not have to be consecutive integers.

Time Action Site A Site B Site C
1 All sites are up and agree that x = 2. 2 2 2
2 Site A updates x = 5. 5 2 2
3 Site C becomes unavailable. 5 2 down
4 Site A pushes update to Site B. Site A and Site B agree that x = 5. Site C is still unavailable. The update transaction remains in the queue at Site A. 5 5 down
5 Site C becomes available with x = 2. Sites A and B agree that x = 5. 5 5 2
6 Site B updates x = 5 to x = 7. 5 7 2
7 Site B pushes the transaction to Site A. Sites A and B agree that x = 7. Site C still says x = 2. 7 7 2
8 Site B pushes the transaction to Site C. Site C says the old value of x = 2; Site B says the old value of x = 5. Oracle detects a conflict and resolves it by applying the update from Site B, which has a higher priority level (25) than Site C (10). All site agree that x = 7. 7 7 7
9 Site A successfully pushes its transaction (x = 5) to Site C. Oracle detects a conflict because the current value at Site C (x = 7) does not match the old value at Site A (x = 2). Site A has a higher priority (30) than Site C (10). Oracle resolves the conflict by applying the outdated update from Site A (x = 5). Because of this ordering conflict, the sites no longer converge. 7 7 5
Table 6 - 2. Ordering Conflicts With Site Priority - More Than Two Masters

You can guarantee convergence when using priority groups if you require that the flow of ownership be ordered. For example, the workflow model dictates that information flow one-way through a three-step sequence:

If the billing site receives a change to a row from the ordering site after the billing site received a change to that row from the shipping site, the billing site ignores the out-of-order change because the change from shipping has a higher priority.

Suggestion: To help determine which conflict resolution method to use, make a diagram or time-action table (such as Table 6 - 2) to help uncover any potential loopholes in your conflict resolution methodology.

Why Use Multiple Resolution Methods

The "Understanding Column Groups" section of this chapter explained that multiple column groups provide multiple conflict resolution methods for a single row. You can also use multiple conflict resolution methods for each column group. Use multiple resolutions methods

Multiple resolution methods are applied in the sequence you set.

Your preferred conflict resolution method might not always succeed. You can specify a backup method to have a greater chance of conflict resolution without manual intervention.

Some system-defined resolution methods, such as latest timestamp, occasionally require a backup method to successfully resolve conflicts. (Site priority is a possible backup method.) The latest timestamp method uses a special timestamp column to determine and apply the most recent change. In the unlikely event that the row at the originating site and the row at another site change at precisely the same second, you must provide a backup method.

Note: Oracle stores time to a granularity of one second.

You can also provide a user-defined method that records conflict information or notifies the DBA if the conflict cannot be resolved. You can arrange to receive notification for all conflicts, or for only those conflicts that cannot be resolved. You can mix any number of user-defined and system-defined conflict resolution routines.

Summary of Standard Conflict Resolution Methods

Convergence means that all sites ultimately agree on the same value. Table 6 - 3 summarizes the system-defined conflict resolution methods, and whether they guarantee convergence between multiple master sites and their associated snapshot sites. Following sections describe each of these methods in greater detail.

Conflict Type Resolution Methods Converge? Converge with >2 Masters?
UPDATE minimum yes no, unless always decreasing
maximum yes no, unless always increasing
earliest timestamp yes no
latest timestamp yes yes, with backup method
priority group yes no, unless always increasing
site priority yes no
overwrite yes, 1 master only no
discard yes, 1 master only no
average (numeric only) yes, 1 master only no
additive (numeric only, additive updates only) yes yes
Uniqueness Constraint (UPDATE or INSERT) append site name no no
append sequence no no
ignore discard no no
DELETE none
Table 6 - 3. Standard Conflict Resolution Methods


Contents Index Home Previous Next