You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/11/10 21:45:16 UTC

[GitHub] [couchdb] xrobau commented on issue #2139: Conflict when adding a previously deleted document

xrobau commented on issue #2139:
URL: https://github.com/apache/couchdb/issues/2139#issuecomment-1310943860

   I'm REALLY REALLY sorry to necro-comment on this ticket, but it's the first google result for this problem, and is annoyingly tricky to solve once you get yourself into this state.  We have a 5 node cluster, and one record was 100% broken because of this. It was returning 404 deleted, but could not be updated (and note we have NOT changed _revs_limit from the default, whatever it may be)
   
   If anyone ELSE is having this problem, and the instructions above don't fix it, you will have to purge the record before you can recreate it.  Here's what my journey was:
   
   ```
   DBURL='http://admin:admin@10.10.10.10:5984/sad_db'
   RECORD=Broken.3924858000126984351
   curl "$DBURL/_changes?filter=_doc_ids&doc_ids=\[\"$RECORD\"\]"
   ```
   That gave me the rev of when it was deleted, which was `2-9c504538e77f1ef3eff158b0f99a6c63` in this case
   
   ```
   R=2-9c504538e77f1ef3eff158b0f99a6c63
   curl "$DBURL/$RECORD?rev=$R"
   ```
   
   I tried posting that straight back, so it would just bump the revision but not change any data, but still had the document conflict. I also tried setting random keys/values/etc to try to make it create rev3, but it wouldn't work and was completely stuck.
   
   This appears to be some sort of edge case bug that I didn't have time to diagnose, so I had to just use the shotgun method, and purge the record and hope that this doesn't cause issues with other nodes that were replicating from this one!
   
   ```
   curl -X POST "$DBURL/_purge" -d "{\"$RECORD\":\[\"$R\"\]}" -Hcontent-type:application/json
   ```
   
   I was then able to import it again, and it appeared as a new record with rev 1.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org