nickva commented on a change in pull request #1574: Fix builtin _sum reduce 
function
URL: https://github.com/apache/couchdb/pull/1574#discussion_r212377506
 
 

 ##########
 File path: src/couch/src/couch_query_servers.erl
 ##########
 @@ -247,6 +248,30 @@ sum_arrays([X|Xs], [Y|Ys]) when is_number(X), 
is_number(Y) ->
 sum_arrays(Else, _) ->
     throw_sum_error(Else).
 
+check_sum_overflow(InSize, OutSize, Sum) ->
+    Overflowed = OutSize > 4906 andalso OutSize * 2 > InSize,
+    case config:get("query_server_config", "reduce_limit", "true") of
+        "true" when Overflowed ->
+            Msg = log_sum_overflow(InSize, OutSize),
+            {[
+                {<<"error">>, <<"builtin_reduce_error">>},
+                {<<"reason">>, Msg}
+            ]};
+        "log" when OutSize > 4096 andalso OutSize > 2 * InSize ->
 
 Review comment:
   Use `Overflowed` variable here as well, it also the updated correct logic 
for overflow.
   
   To double check:
   
   
https://github.com/apache/couchdb/blob/bf72d619d11d787c4cd5bf343d7dfeb4b16ef01a/share/server/views.js#L41

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


With regards,
Apache Git Services

Reply via email to