anchor.diff:          writer_loop(Parent, Reader, Target)
       end.
   
  -write_docs(#http_db{} = Db, Docs) ->
  +write_docs(#http_db{} = Db, Docs, ErrorsAcc) ->
       ErrorsJson = couch_rep_httpc:request(Db#http_db{
           resource = "_bulk_docs",
           method = post,
  
positive.code:         ok;
      {HighSeq, Docs} ->
          DocCount = length(Docs),
          try write_docs(Target, Docs) of
          {ok, []} ->
              Parent ! {update_stats, docs_written, DocCount};
          {ok, Errors} ->
  
negative.code:             Reason = proplists:get_value(<<"reason">>, Props),
              {{Id, Rev}, {ErrId, Reason}}
          end, ErrorsJson),
      case erase(docs_remaining) of
      undefined ->
          {ok, lists:flatten([ErrorsList|ErrorsAcc])};
      MoreDocs ->
          write_docs(Db, MoreDocs, [ErrorsList|ErrorsAcc])
      end;
  write_docs(Db, Docs, _) ->
      couch_db:update_docs(Db, Docs, [], replicated_changes).
  