anchor.diff:              #doc_info{deleted=false} ->
                   {OldCountAcc + 1, OldDelCountAcc};
               _ ->
  -                {OldCountAcc , OldDelCountAcc + 1}
  +                {OldCountAcc, OldDelCountAcc + 1}
               end;
           (not_found, Acc) ->
               Acc
  
positive.code:     {ok, Db2}  = update_local_docs(Db, NonRepDocs),
      
      % Write out the documents summaries (they are stored in the nodes of the rev trees)
      {ok, FlushedRevTrees} = flush_trees(Db2, NewRevTrees, []),
      
      {ok, NewSeq, NewDocsCount, NewDelCount, InfoById, InfoBySeq} =
          new_index_entries(Ids, FlushedRevTrees, LastSeq, 0, 0, [], []),
  
      % and the indexes to the documents
      {ok, DocInfoBySeqBTree2} = couch_btree:add_remove(DocInfoBySeqBTree, InfoBySeq, RemoveSeqs),
  
negative.code: 
  flush_trees(_Db, [], AccFlushedTrees) ->
      {ok, lists:reverse(AccFlushedTrees)};
  flush_trees(#db{fd=Fd}=Db, [InfoUnflushed | RestUnflushed], AccFlushed) ->
          #full_doc_info{rev_tree=Unflushed} = InfoUnflushed,
          Flushed = couch_key_tree:map(
          fun(_Rev, Value) ->
              case Value of
              #doc{attachments=Atts,deleted=IsDeleted}=Doc ->
  