Hibernating Rhinos

Zero friction databases

Dealing with conflicts in RavenDB studio

Recently we added the option to manage bundles in the studio (see http://blogs.hibernatingrhinos.com/12577/ravendb-1-2-studio-features-the-new-database-wizard).

One of these bundles is the Replication bundles, sometimes with replication a conflict can happen (this could happen by several reason like 2 or more documents with the same id being created on different destinations), the way RavenDB deals with this is by creating one document to each of the versions available of the document and in the “original” document we have the names of these copies.

With the new conflict resolution UI when you try to edit the original document you will receive a suggestion of resolution.

Let create a conflict on purpose and see some of the options:

In order to create the conflict we will create 2 databases on the same server, both with replication bundle enabled but we will not set the destination yet:

clip_image002

Now we will create a document on each database with the same Id:

 

clip_image004 clip_image006

Now we will edit the destinations on the left and connect it to the right :

clip_image008

Now we will go to the destination and look the the documents list:

clip_image010

As you can see we have 3 documents with Id starts with “Example/1”.

Now we get to the interesting part if we go and try to edit “Example/1” we will get the next page:

clip_image012

The Studio realizes that we wanted to edit a document that had a conflict and gave us a suggestion, as long as there are comments on the document you will not be able to save it.

Now you can see that RavenDB Studio saw an issue with the Name, we give you a list of all possible names and all you need to do is delete what you don’t want there.

Let say we want it to be “Hibernating” we will delete what we don’t want and save:

Before save:

clip_image014

After save:

clip_image016

Now if we take a look at the documents list you can see that we are left with just the fixed version:

clip_image018

Now let look what RavenDB will suggest for several other conflicts:

Example 2 – Same Item:

clip_image020 clip_image021

The result:

clip_image023

Notice that we still let you know that a conflict has accrued but you have not comments in there which means you can simply save to resolve the conflict

Example 3 – List With Different Items

clip_image025 clip_image027

The result:

clip_image029

We put both items in the array but add the comment so that the user will know that the data was changed.

Example 4 – List with some items the same and some different

clip_image031 clip_image033

The result:

clip_image035

We combined all the data into one array with no repeats and inform on the change.

For more about conflicts read: https://ravendb.net/docs/server/scaling-out/replication/handling-conflicts

Comments

Andrew
09/19/2012 10:49 PM by
Andrew

Interesting approach. Is this happening client side in silverlight? or is this a change happening at the server level?

Ayende Rahien
09/20/2012 07:05 AM by
Ayende Rahien

Andrew, This is a change that is happening on the client side. We haven't change anything server side.

Comments have been closed on this topic.