You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "rnewson (via GitHub)" <gi...@apache.org> on 2025/10/29 23:27:13 UTC

Re: [PR] Enhance reduce limit [couchdb]

rnewson commented on PR #5673:
URL: https://github.com/apache/couchdb/pull/5673#issuecomment-3465008081

   will update the PR tomorrow but I think intercepting the error at a point where we know the dbname and viewname is easier than trying to figure out the filepath, plus this way we log once per _view call
   
   ```
   diff --git a/src/fabric/include/fabric.hrl b/src/fabric/include/fabric.hrl
   index 6312741c2..1996ab1b2 100644
   --- a/src/fabric/include/fabric.hrl
   +++ b/src/fabric/include/fabric.hrl
   @@ -12,6 +12,7 @@
   
    -record(collector, {
        db_name=nil,
   +    view_name,
        query_args,
        callback,
        counters,
   diff --git a/src/fabric/src/fabric_view_reduce.erl b/src/fabric/src/fabric_view_reduce.erl
   index 3206d01a4..c05ddaac3 100644
   --- a/src/fabric/src/fabric_view_reduce.erl
   +++ b/src/fabric/src/fabric_view_reduce.erl
   @@ -50,7 +50,7 @@ go(Db, DDoc, VName, Args, Callback, Acc, VInfo) ->
                    Callback({error, insufficient_storage}, Acc);
                {ok, Workers} ->
                    try
   -                    go2(DbName, Workers, VInfo, CoordArgs, Callback, Acc)
   +                    go2(DbName, Workers, VName, VInfo, CoordArgs, Callback, Acc)
                    after
                        fabric_streams:cleanup(Workers)
                    end;
   @@ -64,7 +64,7 @@ go(Db, DDoc, VName, Args, Callback, Acc, VInfo) ->
            rexi_monitor:stop(RexiMon)
        end.
   
   -go2(DbName, Workers, {red, {_, Lang, View}, _} = VInfo, Args, Callback, Acc0) ->
   +go2(DbName, Workers, VName, {red, {_, Lang, View}, _} = VInfo, Args, Callback, Acc0) ->
        #mrargs{limit = Limit, skip = Skip, keys = Keys, update_seq = UpdateSeq} = Args,
        RedSrc = couch_mrview_util:extract_view_reduce(VInfo),
        OsProc =
   @@ -74,6 +74,7 @@ go2(DbName, Workers, {red, {_, Lang, View}, _} = VInfo, Args, Callback, Acc0) ->
            end,
        State = #collector{
            db_name = DbName,
   +        view_name = VName,
            query_args = Args,
            callback = Callback,
            counters = fabric_dict:init(Workers, 0),
   @@ -169,6 +170,9 @@ handle_message({meta, Meta0}, {Worker, From}, State) ->
        end;
    handle_message(#view_row{} = Row, {_, _} = Source, State) ->
        handle_row(Row, Source, State);
   +handle_message({view_row, #{value := {[{reduce_overflow_error, Msg}]}}} = Row, {_, _} = Source, State) ->
   +    couch_log:warning("reduce_overflow from ~s:~s: ~s", [State#collector.db_name, State#collector.view_name, Msg]),
   +    handle_row(Row, Source, State);
    handle_message({view_row, #{}} = Row, {_, _} = Source, State) ->
        handle_row(Row, Source, State);
    handle_message(complete, Worker, #collector{counters = Counters0} = State) ->
   ```


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org