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/12/12 09:10:06 UTC

[GitHub] [couchdb] lostnet commented on issue #2210: large attachments and all_docs stopped working since 2.1

lostnet commented on issue #2210: large attachments and all_docs stopped working since 2.1
URL: https://github.com/apache/couchdb/issues/2210#issuecomment-564916712
 
 
   Due to [find not supporting attachments](https://github.com/apache/couchdb/issues/1974) I don't see a simple alternative to fixing all_docs to not have a hardcoded per record timeout. I have put together an example of making it conditional on whether attachments are in use, but never hardcoded as an example of the pattern I think is necessary to not cause timeouts that can't be worked around on older hardware, larger docs and attachments, etc:
   
   ```
   diff --git a/src/fabric/src/fabric_view_all_docs.erl b/src/fabric/src/fabric_view_all_docs.erl
   index 07cd1b180..6319f5bd2 100644
   --- a/src/fabric/src/fabric_view_all_docs.erl
   +++ b/src/fabric/src/fabric_view_all_docs.erl
   @@ -119,8 +119,14 @@ go(DbName, Options, QueryArgs, Callback, Acc0) ->
            Callback({error, timeout}, Acc0)
        end.
    
   +msg_timeout(DocOpts) ->
   +	case lists:member(attachments, DocOpts) of
   +		false -> fabric_util:request_timeout();
   +		_ -> fabric_util:attachments_timeout()
   +	end.
   +
    go(DbName, _Options, Workers, QueryArgs, Callback, Acc0) ->
   -    #mrargs{limit = Limit, skip = Skip, update_seq = UpdateSeq} = QueryArgs,
   +    #mrargs{limit = Limit, skip = Skip, update_seq = UpdateSeq, doc_options = DocOpts} = QueryArgs,
        State = #collector{
            db_name = DbName,
            query_args = QueryArgs,
   @@ -132,7 +138,7 @@ go(DbName, _Options, Workers, QueryArgs, Callback, Acc0) ->
            update_seq = case UpdateSeq of true -> []; false -> nil end
        },
        case rexi_utils:recv(Workers, #shard.ref, fun handle_message/3,
   -        State, fabric_util:view_timeout(QueryArgs), 5000) of
   +        State, fabric_util:view_timeout(QueryArgs), msg_timeout(DocOpts)) of
        {ok, NewState} ->
            {ok, NewState#collector.user_acc};
        {timeout, NewState} ->
   ```

----------------------------------------------------------------
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