anchor.diff:  
   ensure_rep_ddoc_exists(RepDb, DDocId) ->
       case open_rep_doc(RepDb, DDocId) of
  +        {not_found, no_db_file} ->
  +            %% database was deleted.
  +            ok;
           {not_found, _Reason} ->
               {ok, DDoc} = replication_design_doc(DDocId),
               couch_log:notice("creating replicator ddoc", []),
  
positive.code:             true ->
                  ok;
              false ->
                  [gen_server:cast(Server, {resume_scan, ShardName})
                      || ShardName <- replicator_shards(DbName)],
                  ok
              end
          end;
          (_, _) -> ok
  
negative.code:     end.
  
  open_rep_doc(DbName, DocId) ->
      case couch_db:open_int(DbName, [?CTX, sys_db]) of
          {ok, Db} ->
              try
                  couch_db:open_doc(Db, DocId, [ejson_body])
              after
                  couch_db:close(Db)
              end;
          Else ->
              Else
      end.
  
  save_rep_doc(DbName, Doc) ->
  