anchor.diff:  
   -define(DOC_ID_TO_REP_ID, rep_doc_id_to_rep_id).
   -define(REP_ID_TO_DOC_ID, rep_id_to_rep_doc_id).
  +-define(MAX_RETRIES, 10).
  +-define(INITIAL_WAIT, 5).
   
   -record(state, {
       changes_feed_loop = nil,
  
positive.code: 
  handle_call({rep_db_update, Change}, _From, State) ->
      {reply, ok, process_update(State, Change)};
  
  handle_call(Msg, From, State) ->
      ?LOG_ERROR("Replicator DB listener received unexpected call ~p from ~p",
  
negative.code:     {BaseId, _} = RepId = couch_rep:make_replication_id(JsonRepDoc, UserCtx),
      case ets:lookup(?REP_ID_TO_DOC_ID, BaseId) of
      [] ->
          true = ets:insert(?REP_ID_TO_DOC_ID, {BaseId, {DocId, true}}),
          true = ets:insert(?DOC_ID_TO_REP_ID, {DocId, RepId}),
          Server = self(),
          Pid = spawn_link(fun() ->
              start_replication(Server, JsonRepDoc, RepId, UserCtx)
          end),
          State#state{rep_start_pids = [Pid | State#state.rep_start_pids]};
      [{BaseId, {DocId, _}}] ->
          State;
      [{BaseId, {OtherDocId, false}}] ->
          ?LOG_INFO("The replication specified by the document `~s` was already"
              " triggered by the document `~s`", [DocId, OtherDocId]),
          maybe_tag_rep_doc(JsonRepDoc, ?l2b(BaseId)),
          State;
      [{BaseId, {OtherDocId, true}}] ->
          ?LOG_INFO("The replication specified by the document `~s` is already"
              " being triggered by the document `~s`", [DocId, OtherDocId]),
          maybe_tag_rep_doc(JsonRepDoc, ?l2b(BaseId)),
          State
      end.
  