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/01/22 09:46:39 UTC

[GitHub] garrensmith commented on a change in pull request #1804: Make view query limits configurable

garrensmith commented on a change in pull request #1804: Make view query limits configurable
URL: https://github.com/apache/couchdb/pull/1804#discussion_r249705999
 
 

 ##########
 File path: src/couch_mrview/src/couch_mrview_util.erl
 ##########
 @@ -523,6 +525,33 @@ validate_args(#mrst{} = State, Args0) ->
     end.
 
 
+apply_limit(ViewPartitioned, Args) ->
+    LimitType = case ViewPartitioned of
+        true -> "partition_query_limit";
+        false -> "query_limit"
+    end,
+    
+    MaxLimit = config:get_integer("query_server_config",
+        LimitType, ?MAX_VIEW_LIMIT),
+
+    % set the highest limit possible if a user has not 
+    % specified a limit
+    Args1 = case Args#mrargs.limit =:= ?MAX_VIEW_LIMIT
+        andalso MaxLimit =/= infinity of
+        false ->
+            Args;
+        true ->
+            Args#mrargs{
+                limit = MaxLimit
+            }
+    end,
+
+    if Args1#mrargs.limit =< MaxLimit -> Args1; true ->
+        Fmt = "Limit is too large, must not exceed ~p",
 
 Review comment:
   I found the issue. It was because of the `fix_skip_and_limit` function https://github.com/apache/couchdb/blob/master/src/fabric/src/fabric_view.erl#L380
   
   We made the max limit greater than the defined max limit. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services