eiri opened a new pull request #1683: Fixes for _local doc update and 
_bulk_docs operations with new_edits false
URL: https://github.com/apache/couchdb/pull/1683
 
 
   ## Overview
   
   This PR is mostly a refactoring and addresses the following issues:
   
   - Attempt to create a local document with an invalid revision throwing 
`badarg` exception.
   - The documents with `_local` prefix written into a wrong btree on a bulk 
operation with `new_edits` set to `false`.
   - It is possible to create a document with an empty id on a bulk operation 
with `new_edits` set to  `false`
   
   ## Testing recommendations
   
   New tests are expected to pass.
   
   For manual testing here is an expected change of behaviour:
   
   Readable error on an invalid rev for a local doc creation
   ``` 
   curl -X PUT http://127.0.0.1:15984/koi/_local/alice?rev=0-abcdf -d 
'{"name":"Alice"}'
   {"error":"error","reason":"Invalid rev format"}
   ```
   
   Correct creation of a local doc on a bulk update
   ```
   $ curl -X POST http://127.0.0.1:15984/koi/_bulk_docs -d '{"new_edits":false, 
"docs": [{"_id":"_local/alice", "_rev":"0-1", "name":"Alice"}]}'
   []
   $ curl http://127.0.0.1:15984/koi/_local/alice
   {"_id":"_local/alice","_rev":"0-2","name":"Alice"}
   ```
   
   Generation of a missing id on a bulk update
   ```
   $ curl -X POST http://127.0.0.1:15984/koi/_bulk_docs -d '{"new_edits":false, 
"docs": [{"_rev":"1-abcdefgh", "name":"Alice"}]}'
   []
   $ curl http://127.0.0.1:15984/koi/_all_docs -G -d include_docs=true
   {"total_rows":1,"offset":0,"rows":[
   
{"id":"ce4c2d25c9d580c1c5e06a05bb000443","key":"ce4c2d25c9d580c1c5e06a05bb000443","value":{"rev":"1-abcdefgh"},"doc":{"_id":"ce4c2d25c9d580c1c5e06a05bb000443","_rev":"1-abcdefgh","name":"Alice"}}
   ]}
   ```
   
   ## Related Issues or Pull Requests
   
   This closes #1628 
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [x] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to