]
Tristan Tarrant updated ISPN-11802:
-----------------------------------
Fix Version/s: 12.0.0.Dev02
(was: 12.0.0.Dev01)
Create SPI for Cross-Site Replication conflict resolution
---------------------------------------------------------
Key: ISPN-11802
URL:
https://issues.redhat.com/browse/ISPN-11802
Project: Infinispan
Issue Type: Enhancement
Components: Core, Cross-Site Replication
Reporter: Pedro Ruivo
Assignee: Pedro Ruivo
Priority: Major
Fix For: 12.0.0.Dev02
A conflict happens if 2 sites try to update the same key (put/remove) concurrently.
With async Cross-Site Replication (aka IRAC) when a conflict is detected, we use the site
name to pick the winning update.
h2. Interface
{code:java}
interface ABC<V> { // or concrete class
String site(); //the site name which wrote this value
V value(); // the value. can be null if the key was removed
Metadata metadata(); //can be null
}
interface Resolve<K, V> {
ABC<V> resolve(K key, ABC<V> entry1, ABC<V> entry2);
}
{code}
h2. Configuration
Set the class name to use. Can be a {{Class}} object (as shown above) or a {{String}}
with the class name.
For server mode, you need to add your jar with the classes required to {{server/lib}}.
The configuration fails to validate if the conflict resolution class is set with {{SYNC}}
strategy.
{code:java}
ConfigurationBuilder.sites().addBackup()
.site("S")
.strategy(BackupConfiguration.BackupStrategy.ASYNC)
.conflictResolution(MyResover.class);
{code}