You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/10/03 13:13:44 UTC
[GitHub] [couchdb] kocolosk opened a new issue #2227: Skip reading the
revision meta when requesting a specific revision
kocolosk opened a new issue #2227: Skip reading the revision meta when requesting a specific revision
URL: https://github.com/apache/couchdb/issues/2227
## Summary
This one is a less frequent request path but I thought I'd log it anyway. Typically when a user requests a document, we execute two reads in FDB: one read to get the revision identifier of the current winning revision, and a second to get the body of that revision.
When a user requests a specific revision I think we can omit the first read and jump straight to the `?DB_DOCS` space. But we don't. Here's a trace of me requesting a specific revision of a document; the first read GetRange call still goes to the revisions subspace:
![open-doc-revs](https://user-images.githubusercontent.com/16679/66129051-242cb480-e5bd-11e9-82cc-54755b705b88.png)
(the two orange elements are checking metadata versions; I've filed separate issues to address them).
## Desired Behaviour
When a user requests a specific revision on its own we should be able to retrieve that with a single GetRange request.
## Possible Solution
I believe the current code for retrieving specific revisions is here:
https://github.com/apache/couchdb/blob/ff2cdb84f639ea26ac7b1ad85abb0a49c5141c74/src/fabric/src/fabric2_db.erl#L513-L550
There's a lot of extra work, retrieving *all* revisions of a document and building a `couch_key_tree` in memory in order to compute the revision identifier, before finally requesting the revision body at L540:
https://github.com/apache/couchdb/blob/ff2cdb84f639ea26ac7b1ad85abb0a49c5141c74/src/fabric/src/fabric2_db.erl#L540
The fix here would involve some streamlining of that function. There's a decent amount of subtlety there with options like `latest=true`.
## Additional context
This optimization is probably mostly useful for the replicator, which does make requests for specific document revisions all the time.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services