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


##########
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:
   Reducing it back to the built-in intended value of 4096 could break some 
views if they were right on the edge, maybe just make both 5000 (4096 plus some 
overhead).



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