Default Resolver and Custom Resolvers

SQL Replication

Replication

Default Resolver and Custom Resolvers

When you create a merge publication, the conflict resolver is set to the default resolver for all articles in the publication (if you do not plan on using a custom resolver with an article, you do not need to choose a resolver). For each article, you can use the default merge resolver or select an available custom resolver. After an article in a publication is assigned a resolver, that association must be maintained across all publications (for when the same table is in multiple publications). You cannot assign different resolvers to the same article across different publications.

Default Resolver

When you create a push or pull subscription, you specify the behavior of the default resolver by choosing to make the subscription global or local.

By default, SQL Server defines a subscription as local, with a priority value of 0.00. On the Set Subscription Priority page in the Push Subscription Wizard or Pull Subscription Wizard, this selection corresponds to the option for using the priority value of the Publisher when a conflict occurs. If this is retained for all Subscribers, the result is that the Publisher updates win the conflict and between Subscribers that have conflicts, the first Subscriber to synchronize, wins the conflict. For the default merge resolver, the Publisher always wins a conflict; however, a custom resolver can override this rule.

You can also assign a specific priority value to a subscription. On the Set Subscription Priority page in either the Push Subscription Wizard or the Pull Subscription Wizard, this selection corresponds to the option for assigning a specific priority value from 0.00 through 99.99 to the Subscriber. When you make this selection and specify a priority greater than 0.0, you define a global subscription.

If both global and local Subscribers are connected to the Publisher, and changes from a global Subscriber with a priority value greater than 0.00 are synchronized first, subsequent conflicting changes from local Subscribers are rejected. The priority value for the global Subscriber is greater than the priority value of any local Subscriber (which would be 0 prior to merge synchronization). If a local Subscriber synchronizes with the Publisher first, subsequent conflicting changes from global Subscribers or other local Subscribers will be rejected. The priority value for the local Subscriber that was first synchronized with the Publisher assumes the priority value of the Publisher, which always wins a conflict; however, a custom merge resolver can override these rules.

Custom Resolvers

Merge replication allows you to use a variety of custom resolvers to deal with conflict situations. Custom resolvers are always executed where the Merge Agent runs. You can select from a number of out-of-the-box custom resolvers supplied with SQL Server, write a custom stored procedure resolver, or write a COM object resolver in a language such as Microsoft Visual C++® or Microsoft Visual Basic®. If you plan to use a COM object resolver, make sure the DLL is registered at the computer where the Merge Agent runs. For a push subscription, this is the Distributor, and for a pull subscription, it is the Subscriber. For applications that use the Merge ActiveX® Control, the resolver should be registered at the computer where the application executes.

Custom resolvers can be loaded in one of the following ways:

  • By selecting the custom resolver you want in the Create Publication Wizard. This option is found on the Resolver tab, in the Properties dialog box.

  • If you are using stored procedures to set up and configure merge replication, the @resolver_info parameter of the sp_addmergearticle system stored procedure contains the name of the custom conflict resolver to use with the article.

To choose a resolver