anchor.diff:                  end,
                   {ok, Acc};
               ({stop, EndSeq}, Acc) ->
  -                ok = gen_server:call(Server, {rep_db_checkpoint, DbName, EndSeq}),
  +                ok = gen_server:call(Server, {rep_db_checkpoint, DbName, EndSeq}, infinity),
                   {ok, Acc};
               (_, Acc) ->
                   {ok, Acc}
  
positive.code:         fun({updated, DbName}) ->
              case IsReplicatorDbFun(DbName) of
              true ->
                  ok = gen_server:call(Server, {resume_scan, mem3:dbname(DbName)});
              _ ->
                  ok
              end;
             ({deleted, DbName}) ->
              case IsReplicatorDbFun(DbName) of
              true ->
                  ets:delete(?DB_TO_SEQ,DbName);
              _ ->
                  ok
              end;
  
negative.code:     true = ets:delete_all_objects(?DOC_TO_REP),
      true = ets:delete_all_objects(?DB_TO_SEQ).
  
  clean_up_replications(DbName) ->
      ets:foldl(
          fun({{Name, DocId}, RepId}, _) when Name =:= DbName ->
              couch_replicator:cancel_replication(RepId),
              ets:delete(?DOC_TO_REP,{Name, DocId}),
              ets:delete(?REP_TO_STATE, RepId);
             ({_,_}, _) ->
              ok
          end,
          ok, ?DOC_TO_REP),
      ets:delete(?DB_TO_SEQ,DbName).
  
  
  update_rep_doc(RepDbName, RepDocId, KVs) when is_binary(RepDocId) ->
      {Pid, Ref} =
  