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 2018/08/23 16:53:13 UTC

[GitHub] davisp commented on a change in pull request #1574: Fix builtin _sum reduce function

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

 ##########
 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:
   Ah, good catch. I refactored that out intending to have it both places.

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