nickva opened a new issue, #6139:
URL: https://github.com/apache/couchdb/issues/6139

   ### Version
   
   3.5.2
   
   ### Describe the problem you're encountering
   
   When we purge non-leaf revisions (say a parent of  a winning revision, or 
even a non-existing revision) we end up removing the index entry of that FDI 
even if we haven't purged that revision specifically
   
   ### Expected Behaviour
   
   Unless we purge winning revisions index entries should not be affected
   
   
   ### Steps to Reproduce
   
   ```shell
   #!/usr/bin/env bash
   
   C=http://adm:[email protected]:15984
   DB=$C/db
   H='Content-Type: application/json'
   
   curl -sS -XDELETE "$DB" > /dev/null
   curl -sS -XPUT "$DB?q=1" > /dev/null
   
   curl -sS -XPUT $DB/_design/v -H "$H" -d 
'{"views":{"v":{"map":"function(doc){emit(doc._id, doc.v);}"}}}' > /dev/null
   
   a1=$(curl -sS -XPUT $DB/a -H "$H" -d '{"v":"a"}' | jq -r .rev)
   curl -sS -XPUT $DB/a -H "$H" -d '{"_rev":"'$a1'","v":"a2"}' > /dev/null
   curl -sS -XPUT $DB/b -H "$H" -d '{"v":"b"}' > /dev/null
   # doc a: A1 -> A2
   # doc b: B1
   
   echo " * before purge"
   curl -sS $DB/_design/v/_view/v
   
   echo " * purge a1 $a1"
   curl -sS -XPOST $DB/_purge -H "$H" -d '{"a":["'$a1'"]}'
   curl -sS $DB/_design/v/_view/v
   
   echo "* purge bogus rev of b"
   curl -sS -XPOST $DB/_purge -H "$H" -d 
'{"b":["1-00000000000000000000000000000000"]}'
   curl -sS $DB/_design/v/_view/v
   ```
   
   ```
    ./badpurge.sh
    * before purge
   {"total_rows":2,"offset":0,"rows":[
   {"id":"a","key":"a","value":"a2"},
   {"id":"b","key":"b","value":"b"}
   ]}
    * purge a1 1-cd6dcd82d939d5b6220025fbc573b36a
   {"purge_seq":null,"purged":{"a":[]}}
   {"total_rows":1,"offset":0,"rows":[
   {"id":"b","key":"b","value":"b"}
   ]}
   * purge bogus rev of b
   {"purge_seq":null,"purged":{"b":[]}}
   {"total_rows":0,"offset":0,"rows":[
   
   ]}```
   
   We expected the have two rows for a2 and b1
   
   ### Your Environment
   
   _No response_
   
   ### Additional Context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to