eiri opened a new pull request #526: Fix _local_docs end-point URL: https://github.com/apache/couchdb/pull/526 ## Overview This is a second attempt to fix `_local_docs` end-point. The [previous one](https://github.com/apache/couchdb/pull/488) didn't work on big enough btree_local, because local btree doesn't have reduction fun, so reuse of `couch_db_updater:btree_by_id_reduce/2` was crashing on a bad match as soon as btree_local was getting kp_node. Also using full fold to calculate `total_rows` value turned out to be resource expensive when a database have significant number of local documents. This fix avoids calculating of `total_rows` and `offset` instead always setting them to `null` and also setting to `null` `update_seq` when requested, since it doesn't have meaning in context of local documents. A fabric module `fabric_view_all_docs.erl` was copied and modified as `fabric_view_local_docs.erl`, because re-using it for processing of both types of the documents was getting rather convoluted. ## Testing recommendations Unit tests for all invoked dependencies could be run as `make eunit apps=chttpd,fabric,couch_mrview`. There are updated suite `couch_mrview_local_docs_tests` in `couch_mrview`. From HTTP perspective end-point `/{db}/_local_docs` supports all the query parameters of `/{db}/_all_docs` with the difference that `offset`, 'total_rows` and `update_seq` always return `null`. ## JIRA issue number COUCHDB-3337 ## 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
