nickva commented on code in PR #5728:
URL: https://github.com/apache/couchdb/pull/5728#discussion_r2487030348


##########
src/couch/src/couch_query_servers.erl:
##########
@@ -278,29 +279,30 @@ sum_arrays(Else, _) ->
     throw_sum_error(Else).
 
 check_sum_overflow(InSize, OutSize, Sum) ->
-    Overflowed = OutSize > 4906 andalso OutSize * 2 > InSize,
+    Overflowed = OutSize > reduce_limit_threshold() andalso OutSize * 
reduce_limit_ratio() > InSize,
     case config:get("query_server_config", "reduce_limit", "true") of
         "true" when Overflowed ->
-            Msg = log_sum_overflow(InSize, OutSize),
+            Msg = sum_overflow_msg(InSize, OutSize),
             {[
                 {<<"error">>, <<"builtin_reduce_error">>},
                 {<<"reason">>, Msg}
             ]};
-        "log" when Overflowed ->
-            log_sum_overflow(InSize, OutSize),
-            Sum;
         _ ->
             Sum
     end.
 
-log_sum_overflow(InSize, OutSize) ->
+sum_overflow_msg(InSize, OutSize) ->
     Fmt =
         "Reduce output must shrink more rapidly: "
         "input size: ~b "
         "output size: ~b",
-    Msg = iolist_to_binary(io_lib:format(Fmt, [InSize, OutSize])),
-    couch_log:error(Msg, []),
-    Msg.
+    iolist_to_binary(io_lib:format(Fmt, [InSize, OutSize])).
+
+reduce_limit_threshold() ->
+    config:get_integer("query_server_config", "reduce_limit_threshold", 4906).

Review Comment:
   I just meant that 4906 is a whacky value, might as well round it up to 5000. 
It was supposed to be a 4096



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to