anchor.diff:      DocInfoIds = [Id || #doc_info{id=Id} <- MixedInfos],
       LookupResults = couch_btree:lookup(Db#db.id_tree, DocInfoIds),
       % COUCHDB-968, make sure we prune duplicates during compaction
  -    NewInfos0 = lists:usort(fun(#doc_info{id=A}, #doc_info{id=B}) ->
  +    NewInfos0 = lists:usort(fun(#full_doc_info{id=A}, #full_doc_info{id=B}) ->
           A =< B
       end, merge_lookups(MixedInfos, LookupResults)),
   
       NewInfos1 = lists:map(
  -        fun({ok, #full_doc_info{rev_tree=RevTree}=Info}) ->
  +        fun(#full_doc_info{rev_tree=RevTree}=Info) ->
               Info#full_doc_info{rev_tree=couch_key_tree:map(
                   fun(_, _, branch) ->
                       ?REV_MISSING;
  
positive.code:     % the trees, the attachments are already written to disk)
      {ok, FlushedFullDocInfos} = flush_trees(Db2, NewFullDocInfos, []),
  
      {IndexFullDocInfos, IndexDocInfos, UpdatedDDocIds} =
              new_index_entries(FlushedFullDocInfos, [], []),
  
      % and the indexes
      {ok, DocInfoByIdBTree2} = couch_btree:add_remove(DocInfoByIdBTree, IndexFullDocInfos, []),
      {ok, DocInfoBySeqBTree2} = couch_btree:add_remove(DocInfoBySeqBTree, IndexDocInfos, RemoveSeqs),
  
      Db3 = Db2#db{
          id_tree = DocInfoByIdBTree2,
  
negative.code:                     BodyPointer = element(2, LeafVal),
                      {IsDeleted, BodyPointer, SeqAcc + 1}
                  end, Tree),
              {FullInfo#full_doc_info{rev_tree=Tree2}, SeqAcc + 1}
          end, LastSeq, FullDocInfoToUpdate),
  
      IdsToRemove = [Id || {#full_doc_info{id=Id,rev_tree=[]},_}
  