Bidirectional Snapshot Replicaton Setup tutorial
Publishing a DAV collection Defining conflict resolvers

## Preliminaries

Every DAV collection on publisher can have a number of conflict resolvers which are used for conflict resolution. Each conflict resolver has an integer number (order) associated with it. Conflict resolvers are applied in ascending order.

Conflict resolver is a Virtuoso/PL procedure which receives conflicting DAV resource. DAV conflict resolver signatures are described in Virtuoso documentation. Conflict resolver can modify the resource which is passed in as 'inout' arguments. Conflict resolver should return an integer value which will be used for conflict resolution. Possible return values and their meaning are described in Virtuoso documentation.

There is a possibility to automatically generate some types of conflict resolvers. Automatically generated conflict resolver classes are:

- max_mtime -

  resource with maximum modification time wins

- min_mtime -

  resource with minumum modification time wins

- max_ctime -

  resource with maximum creation time wins

- min_ctime -

  resource with minumum creation time wins

- backup -

  backup of resource that lost conflict resolution will be performed, conflict resolution will continue

- notify -

  owner of resource will be notified if his resource lost conflict resolution

- pub_wins -

  publisher always wins

- sub_wins -

  subscriber always wins

## Example defining a conflict resolver

1. Login to the Conductor UI using the dba account.
2. Go to the "Replication" tab and then go to the "Bidirectional Snapshot" tab.
3. Click "Conflict Resolvers" for desired published DAV collection ("/DAV/doc").
4. Press "New Resolver" button.
5. Enter conflict resolver name suffix (enter "max_mtime"), select conflict resolver class (select "max_mtime"). You can optionally specify conflict resolver order (default is 100).
6. Press "Add" button. A conflict resolver will be added. You can view and edit conflict resolver code by selecting the link with its name from the list of conflict resolvers.

## Equivalent SQL commands to above

1. Connect to the Virtuoso server via ISQL utility as DBA user.
2. Create a conflict resolver for collection "/DAV/doc" that will choose a resource with maximum modification time (more recent resource).

       SQL> REPL_ADD_DAV_CR ('/DAV/doc', 'max_mtime', 100, 'max_mtime');