Showing posts with label resolver. Show all posts
Showing posts with label resolver. Show all posts

Thursday, March 22, 2012

Default conflict resolver in Sql 2000

Hi, I'm replicating a database between two instances of Sql 2000 using Merge Replication. I have no custom resolvers at present but I'm seeing something unexpected.

If I change the same record in both databases at the same time, but the changes affect different columns then I thought the changes would be merged and there would be no conflict because the changes were in different columns. What I actually see is a conflict and hence the publisher is winning and pushing it's changed row to the subscriber.

Have I got this wrong, will a conflict occur if the same row changes regardless of the columns updated?

Regards

GrahamCould it be the timestamp column that is causing the conflict? When I set up the publisher I simple published all tables and sp.

Is there any way in enterprise manager establishing what columns conflicted?

Thanks

Graham|||Merge replication can track conflict at row level or column level. It looks that you wanted to track conflicts at column level but set it up at row level.

You can launch conflict viewer to see the conflicts. From Enterprise Manager, if you right click the publication, there should be a menu called View Conflicts.|||Thanks for the reply.

I do have it tracking conflicts at column level. However, I did a little more digging, this is what I found...

I have a published table with two int columns, A and B. The initial data looks like:

A B
--
1 2

If on the publisher I update column A to a value 2 and on the Subscriber I update the same row but Column B to a value 3 the a merge happens and the result is that the pub and the subscriber looks like:

A B
--
2 3

If however, on the publisher I update both columns to A=3 and B=3 (net result only column A has changed) and on the subscriber I again update both columns to A=2 and B=4 (net result only column B changes), I then get a conflict as the agent thinks both A and B have been changed on the publisher and the subscriber.

I was expecting the net results to be sent when the merge agent runs, but it seems to send all the data regardless of whether any column data was changed or not.

Is this behaviour normal?

Regards

Graham
|||Hi Graham,
Yes this is the expected behavior.
Once a column is touched (to the same value or the new value) it will be sent to the other side.
However if you touch the same column multiple times, only the net effect is sent.

Sunday, February 19, 2012

Debugging a Custom Resolver in VS2005

Hi,

I have created a custom resolver in VB .net (VS2005). The resolver works ( Both Publisher and Subscriber are SQL 2005 ), but I need to be able to debug the code within the resolver. How do I do this? I have tried a number of things without success.

Any suggestions would be appreciated.

Cheers

Neil

Neil, you can open the merge agent (replmerg.exe) as a project in Visual Studio 2005, attach symbol files for your custom resolver, set a break point in your custom resolver source code, and run the agent with parameters. You will be able to trace into your resolver code from there.

To open the replmerg.exe as a project in VS2005, go to menu File->Open->File/Project, and choose the executable directly. There is a "Executable" in the dropdown list in the dialog but if it is not there, you need to install VC++ components of VS2005.

|||

That fixed it.

The only other thing I had to do is in the properties of replmerg.exe I had to set the Debugger Type to "Mixed" not leave as "Auto"

Thanks for you help.

Neil