Brian Candler | 1 Nov 2009 12:27
Picon
Favicon

Re: What happens with a document, if a conflict is not resolved?

On Fri, Oct 30, 2009 at 08:37:36PM -0400, Adam Kocoloski wrote:
> The response format is a slightly awkward Array -- I believe the first  
> revision is the winning one.

This is definitely not true. For example, I can get the database into a
state where there are three conflicting versions, and the winning version
is the middle one returned by open_revs=all

$ curl http://127.0.0.1:5984/conflict_test/test?conflicts=true
{"_id":"test","_rev":"10-ca7d1f8bc31d20ad4898e4024547c4c6","hello":"baz","_conflicts":["9-9b4928288c4fc3087833549752bdcdc3","9-2438fa9601119c8fe2c0b2f4a688f65f"]}
$ curl http://127.0.0.1:5984/conflict_test/test?open_revs=all
[{"ok":{"_id":"test","_rev":"9-2438fa9601119c8fe2c0b2f4a688f65f","hello":"bar"}},
{"ok":{"_id":"test","_rev":"10-ca7d1f8bc31d20ad4898e4024547c4c6","hello":"baz"}},
{"ok":{"_id":"test","_rev":"9-9b4928288c4fc3087833549752bdcdc3","hello":"foo"}}]

Code to do this is attached.

Regards,

Brian.
require 'rubygems'
require 'restclient'
require 'json'
DB="http://127.0.0.1:5984/conflict_test"

# Write multiple documents as all_or_nothing, can introduce conflicts
def writem(docs)
  JSON.parse(RestClient.post("#{DB}/_bulk_docs", {
(Continue reading)

Damien Katz | 1 Nov 2009 15:27
Picon
Favicon

Re: What happens with a document, if a conflict is not resolved?

Please feel free to help make this better. All the information you  
want is available on the erlang side, it just sounds like you need it  
exposed in a slightly different way. At the very least write up a  
proposal of how the API should work and file a bug report. Even better  
is to provide a patch in the same bug.

-Damien

On Nov 1, 2009, at 6:27 AM, Brian Candler wrote:

> On Fri, Oct 30, 2009 at 08:37:36PM -0400, Adam Kocoloski wrote:
>> The response format is a slightly awkward Array -- I believe the  
>> first
>> revision is the winning one.
>
> This is definitely not true. For example, I can get the database  
> into a
> state where there are three conflicting versions, and the winning  
> version
> is the middle one returned by open_revs=all
>
> $ curl http://127.0.0.1:5984/conflict_test/test?conflicts=true
> {"_id":"test","_rev":"10- 
> ca7d1f8bc31d20ad4898e4024547c4c6","hello":"baz","_conflicts": 
> ["9 
> -9b4928288c4fc3087833549752bdcdc3 
> ","9-2438fa9601119c8fe2c0b2f4a688f65f"]}
> $ curl http://127.0.0.1:5984/conflict_test/test?open_revs=all
> [{"ok": 
> {"_id 
(Continue reading)


Gmane