-
DescriptionI don't know what happened, but I have a database where some documents are in a very weird state. Let's take one of those documents:
CouchDB tells me that there is a conflict on this document, with 2 branches. The branch for But, when looking at the And, the really weird thing: both branches have the same revisions 5, 4, 3, and 2, but their first revisions are not the same: By the way, I also got:
I think that this revision was compacted on some nodes of the cluster, but not on others. Steps to ReproduceI don't know how to reproduce. I understand that without a way to reproduce, it would be very hard to fix the bug. For the moment, I'd like to understand how it is possible that CouchDB sees two roots in a revision tree, and why a revision that is ancestor of another revision can be seen as a leaf. Expected BehaviourWell, first, I would have expected that CouchDB enforces that the revisions for a document are a tree. And, that a revision listed in Your Environment
{"couchdb":"Welcome","version":"2.3.0","git_sha":"07ea0c7","uuid":"b3ac19e755fb8720ec0be49b61086e87","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}} Additional ContextTo fix a document, we can go this way:
But it's a manual operation. And it doesn't explain how we were in this situation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hiya @nono, This looks like either something was creating its own revisions or there was an accidental copying of revisions between documents that were then inserted using new_edits=false. A subtlety of the tree is that the the revision identifiers only have to be unique at the node level. Generally they're unique to the tree unless we get into shenangians around using new_edits=false in which case the actual constraints of the tree are much looser than what normally happens. And unfortunately a lot of the traversal algorithms assume unique revisions so when you specify them for some operations you may not be getting the one you expect. Your best bet would be to purge the 11- revision so that you're back to a linear history and then move on. In the future I'd avoid using new_edits=false in application code. Paul |
Beta Was this translation helpful? Give feedback.
Hiya @nono,
This looks like either something was creating its own revisions or there was an accidental copying of revisions between documents that were then inserted using new_edits=false. A subtlety of the tree is that the the revision identifiers only have to be unique at the node level. Generally they're unique to the tree unless we get into shenangians around using new_edits=false in which case the actual constraints of the tree are much looser than what normally happens. And unfortunately a lot of the traversal algorithms assume unique revisions so when you specify them for some operations you may not be getting the one you expect.
Your best bet would be to purge the 11- revision so …