nickva commented on issue #6162:
URL: https://github.com/apache/couchdb/issues/6162#issuecomment-6181297587
An even simpler reproducer
```shell
#!/usr/bin/env bash
set -eu
DB=${DB:-http://adm:[email protected]:15984}
hreq() {
http --ignore-stdin --print=b --check-status "$@"
}
http DELETE "$DB/db1" > /dev/null
http DELETE "$DB/db2" > /dev/null
http PUT "$DB/db1" > /dev/null
hreq PUT "$DB/db2" > /dev/null
hreq PUT "$DB/db2/_design/vdu" validate_doc_update='function(n, o) {}' >
/dev/null
for d in db1 db2; do
# 1-a [a]
hreq PUT "$DB/$d/doc" new_edits==false v=a _rev=1-a
_revisions:='{"start": 1, "ids": ["a"]}' > /dev/null
# 2-b [b] stemmed history (source with a lower revs_limit), 2-b is a
second root
hreq PUT "$DB/$d/doc" new_edits==false v=b _rev=2-b
_revisions:='{"start": 2, "ids": ["b"]}' > /dev/null
# 2-b [b<-a]: Same revisin with its full history: db1 merges
# it and 1-a stops being a leaf. But db2 (VDU) drops it as it's already
there.
hreq PUT "$DB/$d/doc" new_edits==false v=b _rev=2-b
_revisions:='{"start": 2, "ids": ["b", "a"]}' > /dev/null
# 3-c [c<-b] deletes 2-b. Db2 the stale 1-a is then the only live leaf
and wins
hreq PUT "$DB/$d/doc" new_edits==false _deleted:=true _rev=3-c
_revisions:='{"start": 3, "ids": ["c", "b"]}' > /dev/null
done
echo "=== db1 (no vdu) ==="
hreq GET "$DB/db1/doc" open_revs==all revs==true Accept:application/json
echo "=== db2 (allow all vdu) ==="
hreq GET "$DB/db2/doc" open_revs==all revs==true Accept:application/json
```
Produces
=== db1 (no vdu) ===
```json
[
{
"ok": {
"_deleted": true,
"_id": "doc",
"_rev": "3-c",
"_revisions": {
"ids": [
"c",
"b",
"a"
],
"start": 3
}
}
}
]
```
=== db2 (allow all vdu) ===
```json
[
{
"ok": {
"_id": "doc",
"_rev": "1-a",
"_revisions": {
"ids": [
"a"
],
"start": 1
},
"v": "a"
}
},
{
"ok": {
"_deleted": true,
"_id": "doc",
"_rev": "3-c",
"_revisions": {
"ids": [
"c",
"b"
],
"start": 3
}
}
}
]
```
--
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]