CouchDB replication stopped after _conflict

I have a user who today does not replicate new documents that other users add to my CoucDB database, in other words, user A does not see documents that users B, C are added every day.

I saw the last document added by user A in CouchDB, and I saw that the document has a new field

_conflicts: ["2-17d3fcec15fbe3b1eed3e7f8a14eae35"]}

enter image description here

I suppose the conflict is in the second revision of the document, right? I have 7 versions of the same document my question is: how can I solve this? How can I remove this conflict?

+5
source share
1 answer

CouchDB does not attempt to merge the conflicting revision.

Your application determines how the merge should be performed.

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

but, generally speaking, the proposed algorithm for obtaining a document with conflict resolution:

  • Get a document through GET docid?conflicts=true request ;
  • For each member of the _conflicts array call GET docid?rev=xxx . If at this stage any errors occur, restart from step 1. (There may be a race when someone else resolved this conflict and deleted this rev)
  • Perform Application Merge
  • Write _bulk_docs updating to the first turn and deleting other turns.

alos see ruby version

+2
source

Source: https://habr.com/ru/post/1274871/


All Articles