CouchDB replication stopped after a _conflict

230 Views Asked by At

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?

1

There are 1 best solutions below

1
venergiac On BEST ANSWER

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