anchor.diff:      ets:update_counter(Stats, docs_read, length(Docs)),
       
       %% save them (maybe in a buffer)
  -    {NewBuffer, NewContext} = case couch_util:should_flush() of
  +    {NewBuffer, NewContext} = 
  +    case should_flush(lists:flatlength([Docs|Buffer])) of
           true ->
               Docs2 = lists:flatten([Docs|Buffer]),
               {ok, Errors} = update_docs(Target, Docs2, [], replicated_changes),
  
positive.code: 
  -export([replicate/2]).
  
  -include("couch_db.hrl").
  
  %% @spec replicate(Source::binary(), Target::binary()) -> 
  %%      {ok, Stats} | {error, Reason}
  
negative.code:         [Id, couch_doc:rev_to_str(Rev), Error]),
      dump_update_errors(Rest).
  
  attachment_loop(ReqId, Conn) ->
      couch_util:should_flush(),
      receive 
          {From, {set_req_id, NewId}} ->
              %% we learn the ReqId to listen for
              From ! {self(), {ok, NewId}},
              attachment_loop(NewId, Conn);
          {ibrowse_async_headers, ReqId, Status, Headers} ->
              %% we got header, give the controlling process a chance to react
              receive 
  