Github user chewbranca commented on a diff in the pull request:

    https://github.com/apache/couchdb-fabric/pull/1#discussion_r11401289
  
    --- Diff: src/fabric_view_reduce.erl ---
    @@ -84,6 +74,30 @@ handle_message({rexi_EXIT, Reason}, Worker, State) ->
             {error, Resp}
         end;
     
    +%% HACK: this just sends meta once. Instead we should move the counter 
logic
    +%% from the #view_row handle_message below into this function and and pass 
the
    +%% meta call through maybe_send_row. This will also be more efficient 
doing it
    +%% here as it's one less worker round trip reply.
    +%% Prior to switching to couch_mrview, the fabric_view_reduce 
implementation
    +%% did not get a total_and_offset call, whereas now we do. We now use this
    +%% message as a clean way to indicate to couch_mrview_http:view_cb that the
    +%% reduce response is starting.
    +handle_message({meta, Meta}, {_Worker, From}, State) ->
    +    gen_server:reply(From, ok),
    +    #collector{
    +        callback = Callback,
    +        user_acc = AccIn
    +    } = State,
    +
    +    {Go, Acc} = case get(meta_sent) of
    +        undefined ->
    +            put(meta_sent, true),
    --- End diff --
    
    More details about this are in the commit message of aeac2df.
    
    Basically this is a temporary hack to keep of sending the metadata so that 
we only send it once. The previous fabric view reduce implementation did not 
have metadata rows, so this wasn't send along, whereas the new couch_mrview 
implementation does send them, and it's a very clean way to indicate a view 
reduce is starting. The update to stream this through 
`fabric_view:maybe_send_row` is complicated, and outside the scope of this 
initial work as I want to get some wider feedback on approach there.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to