anchor.diff:                         body = Body},
                   maybe_flush_docs_xmem(XMemLoc, Batch, Doc, BatchSize, BatchItems)
           end,
  -    {ok, DataFlushed2} = local_process_batch(Rest, Cp, Target, Batch2, BatchSize, BatchItems, XMemLoc),
  -    %% return total data flushed
  -    {ok, DataFlushed + DataFlushed2}.
  +    local_process_batch(Rest, Cp, Target, Batch2, BatchSize, BatchItems, XMemLoc, Acc + DataFlushed).
   
   
   -spec flush_docs_helper(any(), list(), term()) -> ok.
  
positive.code:     end.
  
  
  local_process_batch([], _Cp, _Tgt, #batch{docs = []}, _BatchSize, _BatchItems, _XMemLoc) ->
      {ok, 0};
  local_process_batch([], Cp, #httpdb{} = Target,
                      #batch{docs = Docs, size = Size}, BatchSize, BatchItems, XMemLoc) ->
      ?xdcr_trace("worker process flushing a batch docs of total size ~p bytes",
                  [Size]),
      ok = flush_docs_helper(Target, Docs, XMemLoc),
      {ok, DataRepd1} = local_process_batch([], Cp, Target, #batch{}, BatchSize, BatchItems, XMemLoc),
      {ok, DataRepd1 + Size};
  
  local_process_batch([Mutation | Rest], Cp,
                      #httpdb{} = Target, Batch, BatchSize, BatchItems, XMemLoc) ->
      #upr_mutation{id = Key,
                    local_seq = KeySeq,
                    rev = {RevA, _RevB} = Rev,
  
negative.code:             Start = now(),
              {ok, DataRepd} = local_process_batch(
                                 MissingDocInfoList, Cp, Target,
                                 #batch{}, BatchSize, BatchItems, XMemLoc, 0),
  
              %% the latency returned should be coupled with batch size, for example,
              %% if we send N docs in a batch, the latency returned to stats should be the latency
  