Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CouchDB replication stopped after a _conflict

I have a user that today is not replicating the new documents that the others users are adding on my CoucDB database, in other words the user A does not see the docuemnts that the users B, C is adding every day.

I have seen the last document added from the user A to CouchDB and I have seen that the document has a new field

_conflicts: ["2-17d3fcec15fbe3b1eed3e7f8a14eae35"]}

enter image description here

I guess the conflict is in the second revision of the document, Is not it? I have 7 revision about the same document my question is How I can resolve it? How I can remove this conflict?

like image 518
JoCuTo Avatar asked Oct 28 '22 20:10

JoCuTo


1 Answers

CouchDB does not attempt to merge the conflicting revision.

Your application dictates how the merging should be done.

see http://docs.couchdb.org/en/2.0.0/replication/conflicts.html

but generaly speaking the suggested algorithm to fetch a document with conflict resolution:

  • Get document via GET docid?conflicts=true request;
  • For each member in the _conflicts array call GET docid?rev=xxx. If any errors occur at this stage, restart from step 1. (There could be a race where someone else has already resolved this conflict and deleted that rev)
  • Perform application-specific merging
  • Write _bulk_docs with an update to the first rev and deletes of the other revs.

alos see the version on ruby

like image 68
venergiac Avatar answered Dec 09 '22 10:12

venergiac