ondra-novak commented on issue #1235: Idea: Bring back all_or_nothing
URL: https://github.com/apache/couchdb/issues/1235#issuecomment-376330010
 
 
   Okaj, let's assume that this is about a new feature.
   
   1. We have a document with conflicts.  There is main revision and the one or 
more conflicted revisions (deleted conflicts are not included)
   2.  Let there is some automate process which is able to merge the most of 
conflicts
   3. The automate process creates a new main document and then a set of delete 
requests for conflicted revisions. The conflicted revision is deleted by simple 
putting _deleted flag into it.
   4. The _bulk_docs request is prepared and send to couchdb
   5.  - question of the ordering? Is it better to put main revision as the 
first or as the last? With clustered database, this is hard to decide. In my 
code, i always put the main revision as the last, because if the changes are 
applied in the order - it is single document mapped to single shard(?) - the 
changes feed will contain deleted conflicts as the first and then the updated 
main revision.
   6. Now, we have VDU. The purpose of  VDU is also to detected malformed 
merged documents. 
   7. however, the VDU rejects the malformed document, but it cannot reject 
deletion of the conflict. 
   8. As the result, the conflicted revisions are deleted (and lost after 
compaction). The main revision is not updated, so updates are also lost.
   
   The workaround is to reconstruct conflicted documents back using the data 
temporary stored in the memory of that automated process -  but this is very 
ugly solution. It would be better to call VDU on the main revision and test it 
before the write
   
   Hmm, other workaround is to send main revision as the single request and 
delete conflicts only if the request passes. This has other issues. It needs 
two request. The new revision of the main document can be replicated and it 
still looks like conflicted, because conflicts has not been deleted yet. There 
can be also another process (for instance on other replica) which will try to 
merge conflicts with already updated revision. So this is the reason, why I am 
sending  updated document as the last item
   
   To improve the work with conflicts i have just another suggestion, the field 
"_merged", but this will need an another ticket and looks more complicated than 
above suggestion.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to