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

------------------------------------------------------------------------------
  {"_id":"doc1","_rev":"3851869530","hello":"world"} 
  }}}
  
- === Create conflicting updates ===
+ === Introduce conflicting updates ===
  
  ''Note: the updates have to be made on separate databases. Update conflicts 
can't occur within a single database; because you provide the original _rev, if 
someone else has already changed the document, the second update is rejected.''
  
@@ -159, +159 @@

  {"_id":"doc1","_rev":"2575525432","hello":"jim","_conflicts":["132006080"]}
  }}}
  
+ === Compaction ===
+ 
+ The conflict status, and the conflicting versions, remain even after 
compaction. However the very original version, which was not in conflict, does 
not.
+ 
+ {{{
+ $ curl -X POST http://localhost:5001/sampledb/_compact
+ {"ok":true}
+ $ curl -X POST http://localhost:5002/sampledb/_compact
+ {"ok":true}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true
+ {"_id":"doc1","_rev":"2575525432","hello":"jim","_conflicts":["132006080"]}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?rev=132006080
+ {"_id":"doc1","_rev":"132006080","hello":"fred"}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?rev=2575525432
+ {"_id":"doc1","_rev":"2575525432","hello":"jim"}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?rev=3851869530
+ {"error":"{not_found,missing}","reason":"3851869530"}
+ }}}
+ 
+ === Conflict Resolution ===
+ 
+ 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.''
+ 
+ {{{
+ $ curl -X PUT -d '{"_rev":"2575525432","hello":"resolved"}' 
http://localhost:5001/sampledb/doc1
+ {"ok":true,"id":"doc1","rev":"923422654"}
+ $ curl http://127.0.0.1:5001/sampledb/doc1?conflicts=true
+ 
{"_id":"doc1","_rev":"923422654","hello":"resolved","_conflicts":["132006080"]}
+ }}}
+ 

Reply via email to