anchor.diff:          end
       end;
   
  -maybe_flush_docs(#db{} = Target, #batch{docs = DocAcc, size = SizeAcc},
  -    #doc{atts = []} = Doc) ->
  +maybe_flush_docs(#db{} = Target, #batch{docs = DocAcc, size = SizeAcc}, Doc) ->
       case SizeAcc + 1 of
       SizeAcc2 when SizeAcc2 >= ?DOC_BUFFER_LEN ->
           ?LOG_DEBUG("Worker flushing doc batch of ~p docs", [SizeAcc2]),
  
positive.code:     end.
  
  
  local_doc_handler({ok, #doc{atts = []} = Doc}, {Target, DocList, W, F}) ->
      {Target, [Doc | DocList], W, F};
  local_doc_handler({ok, Doc}, {Target, DocList, W, F}) ->
      ?LOG_DEBUG("Worker flushing doc with attachments", []),
      Target2 = open_db(Target),
      Success = (flush_doc(Target2, Doc) =:= ok),
      close_db(Target2),
      case Success of
      true ->
          {Target, DocList, W + 1, F};
      false ->
          {Target, DocList, W, F + 1}
      end;
  local_doc_handler(_, Acc) ->
      Acc.
  
negative.code: 
  
  maybe_flush_docs(#httpdb{} = Target,
      #batch{docs = DocAcc, size = SizeAcc} = Batch, Doc) ->
      case batch_doc(Doc) of
      false ->
          ?LOG_DEBUG("Worker flushing doc with attachments", []),
          case flush_doc(Target, Doc) of
          ok ->
  