Closed ermouth closed 2 years ago
@ermouth I think this was fixed for 2.2.0, see https://github.com/apache/couchdb/pull/961
if not let me know and we can reopen
Confirmed:
$ curl -X PUT localhost:15984/abc
{"error":"file_exists","reason":"The database could not be created, the file already exists."}
$ curl -X POST -H "Content-Type: application/json" localhost:15984/abc/_index -d '{"ddoc":"", "index":{"fields": ["food"]}}'
{"result":"created","id":"_design/","name":"3c4336c43e5e1a54362c91818f3909a95ba10120"}
$ curl localhost:15984/abc/_design
{"error":"not_found","reason":"missing"}
$ curl localhost:15984/abc/_design/
{"error":"not_found","reason":"missing"}
$ curl localhost:15984/abc/_all_docs
{"total_rows":3,"offset":0,"rows":[
{"id":"_design/","key":"_design/","value":{"rev":"1-b17f56e26b76133f3c9dc111f6222da6"}},
{"id":"a","key":"a","value":{"rev":"1-73a83873149212c382ed9432f4df7b3a"}},
{"id":"b","key":"b","value":{"rev":"1-0f07c7dbc9a29f0d0c2729f9c61f5411"}}
]}
This still happens. With auto-indexer (ken) it's even worse as it will start crashing as well and flooding the logs with failures that look like:
[error] 2021-11-04T17:19:00.390502Z node1@127.0.0.1 emulator -------- Error in process <0.16318.0> on node 'node1@127.0.0.1' with exit value:
{{nocatch,{illegal_docid,<<"Illegal document id `_design/`">>}},[{couch_doc,validate_docid,1,[{file,"src/couch_doc.erl"},{line,213}]},{couch_doc,transfer_fields,3,[{file,"src/couch_doc.erl"},{line,252}]},{ken_server,'-update_db_indexes/2-fun-1-',4,[{file,"src/ken_server.erl"},{line,280}]},{lists,foldl,3,[{file,"lists.erl"},{line,1263}]},{ken_server,update_db_indexes,2,[{file,"src/ken_server.erl"},{line,279}]}]}
It appears that https://github.com/apache/couchdb/pull/3990 fixes this issue, so closing as resolved.
Expected Behavior
CouchDB should prevent creation of Mango index ddoc with the
_design/
_id.Current Behavior
POST-ing JSON body with
"ddoc":""
field to/db/_index
creates a ddoc, which seems non-deletable, effectively breaks replication and makes DB non-writable (both PUT and POST fail with 500).Steps to Reproduce
"ddoc":""
fieldContext
I was creating Mango index editor in Couch Photon, and noticed the issue during UI tests.
Your Environment