Github user rnewson commented on a diff in the pull request:

    https://github.com/apache/couchdb-chttpd/pull/90#discussion_r43617014
  
    --- Diff: src/chttpd_view.erl ---
    @@ -94,3 +94,20 @@ handle_view_req(Req, _Db, _DDoc) ->
     handle_temp_view_req(Req, _Db) ->
         Msg = <<"Temporary views are not supported in CouchDB">>,
         chttpd:send_error(Req, 403, forbidden, Msg).
    +
    +make_etag(Db, DDoc, ViewName, Args) ->
    +    DbName = Db#db.name,
    +    DDocId = DDoc#doc.id,
    +    {ok, ViewGroupInfo} = fabric:get_view_group_info(DbName, DDocId),
    --- End diff --
    
    maybe, but remember that caching isn't magic, it's only useful if it's 
cheaper than querying again.
    
    Here's an implementation idea that should be no more expensive than what we 
do today;
    
    1) delay the response until we have heard from one shard of each range (I 
believe we already added this, but do check)
    2) from this, construct the etag (we can change the workers to return more 
information along with their first rows (if any)
    3) send 304 if the etag matches the header
    
    That is, we have to hear from one shard per range to form the view, so we 
can build a useful etag from that.
    
    For 2.0, I would remove the random etag without replacement, since that is 
probably causing useless cache bloat on the receiving end, we implicitly 
promise there's a chance of a cache hit where there is no chance.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to