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 2021/09/15 18:58:45 UTC

[GitHub] [couchdb] nickva edited a comment on issue #3750: sharded view queries sometimes™ miss view result metadata

nickva edited a comment on issue #3750:
URL: https://github.com/apache/couchdb/issues/3750#issuecomment-920294880


   I think this might fix it:
   
   ```
    git diff
   diff --git a/src/fabric/src/fabric_view_map.erl b/src/fabric/src/fabric_view_map.erl
   index b8d0d392a..eed6af74e 100644
   --- a/src/fabric/src/fabric_view_map.erl
   +++ b/src/fabric/src/fabric_view_map.erl
   @@ -147,9 +147,9 @@ handle_message({meta, Meta0}, {Worker, From}, State) ->
        end;
   
    handle_message(#view_row{}, {_, _}, #collector{limit=0} = State) ->
   -    #collector{callback=Callback} = State,
   -    {_, Acc} = Callback(complete, State#collector.user_acc),
   -    {stop, State#collector{user_acc=Acc}};
   +    % rely on limit=0 special clause in maybe_send_row to wait until all
   +    % shard ranges reply
   +    fabric_view:maybe_send_row(State);
   
    handle_message(#view_row{} = Row, {_,From}, #collector{sorted=false} = St) ->
        #collector{callback=Callback, user_acc=AccIn, limit=Limit} = St,
   ```
   
   We rely on the logic in https://github.com/apache/couchdb/blob/9f081914fe1fd7f31c2c1c7b3ead89427cf342f3/src/fabric/src/fabric_view.erl#L124-L134 to already wait until we have completed the ring with meta only (we don't bump counters with any rows returned)
   
   Interestingly enough, there is a remnant `erase(meta_sent),` of some attempt at row send waiting until we sent meta...


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