couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "How to replicate a database" by BrianCandler
Date Wed, 28 Jan 2009 17:20:25 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by BrianCandler:
http://wiki.apache.org/couchdb/How_to_replicate_a_database

The comment on the change is:
Add info about resolving conflicts plus a small shell script

------------------------------------------------------------------------------
  
  All nodes see the same conflict state and history, so any of them can resolve the conflict.
  
- ''FIXME: How to resolve the conflict? Simply writing a new version of the document is not
sufficient.''
+ Nodes can continue to add new versions, but conflict remains:
  
  {{{
  $ curl -X PUT -d '{"_rev":"2575525432","hello":"resolved"}' http://localhost:5001/sampledb/doc1
@@ -191, +191 @@

  {"_id":"doc1","_rev":"923422654","hello":"resolved","_conflicts":["132006080"]}
  }}}
  
+ Once the application is satisfied that it has resolved the conflict, it simply has to DELETE
the conflicting revision. Couch actually keeps a separate list of deleted conflict revisions
that you can view with "deleted_conflicts=true"
+ 
+ {{{
+ $ curl -X DELETE http://127.0.0.1:5001/sampledb/doc1?rev=132006080
+ {"ok":true,"id":"doc1","rev":"3699698383"}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true
+ {"_id":"doc1","_rev":"804871722","hello":"resolved"}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?deleted_conflicts=true
+ {"_id":"doc1","_rev":"804871722","hello":"resolved","_deleted_conflicts":["3699698383"]}
+ }}}
+ 
  === Sample shell script ===
  
- Running this script gives an easy way to demonstrate replication behaviour.
+ Running this script gives an easy way to set up a replication conflict so you can examine
it and resolve it.
  
  {{{
  #!/bin/sh

Mime
View raw message