anchor.diff:      NonRepDocs2 = [{Client, NRDoc} || NRDoc <- NonRepDocs],
       try update_docs_int(Db, GroupedDocs3, NonRepDocs2, MergeConflicts,
                   FullCommit2) of
  -    {ok, Db2} ->
  +    {ok, Db2, UpdatedDDocIds} ->
           ok = gen_server:call(Db#db.main_pid, {db_updated, Db2}),
           if Db2#db.update_seq /= Db#db.update_seq ->
               couch_db_update_notifier:notify({updated, Db2#db.name});
           true -> ok
           end,
           [catch(ClientPid ! {done, self()}) || ClientPid <- Clients],
  +        lists:foreach(fun(DDocId) ->
  +            couch_db_update_notifier:notify({ddoc_updated, {Db#db.name, DDocId}})
  +        end, UpdatedDDocIds),
           {noreply, Db2}
       catch
           throw: retry ->
  
positive.code: 
  
  
  new_index_entries([], AccById, AccBySeq) ->
      {AccById, AccBySeq};
  new_index_entries([FullDocInfo|RestInfos], AccById, AccBySeq) ->
      #doc_info{revs=[#rev_info{deleted=Deleted}|_]} = DocInfo =
              couch_doc:to_doc_info(FullDocInfo),
      new_index_entries(RestInfos,
          [FullDocInfo#full_doc_info{deleted=Deleted}|AccById],
          [DocInfo|AccBySeq]).
  
  
  stem_full_doc_infos(#db{revs_limit=Limit}, DocInfos) ->
  
negative.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, []),
  