From d0d251175a2800b44ef337663c04d7cfc207d711 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sun, 21 Mar 2010 20:02:37 +0000 Subject: Take query options into account when generating replication ids. Patch by Filipe Manana. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@925879 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep.erl | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/couchdb') diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 8e83ebca..b7f87901 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -451,20 +451,21 @@ make_replication_id({Props}, UserCtx) -> % Port = mochiweb_socket_server:get(couch_httpd, port), Src = get_rep_endpoint(UserCtx, proplists:get_value(<<"source">>, Props)), Tgt = get_rep_endpoint(UserCtx, proplists:get_value(<<"target">>, Props)), - Filter = proplists:get_value(<<"filter">>, Props), - QueryParams = proplists:get_value(<<"query_params">>, Props), - DocIds = proplists:get_value(<<"doc_ids">>, Props), - Base = couch_util:to_hex(erlang:md5( - case DocIds of + Base = [HostName, Src, Tgt] ++ + case proplists:get_value(<<"filter">>, Props) of undefined -> - term_to_binary([HostName, Src, Tgt, Filter, QueryParams]); - DocIds -> - term_to_binary([HostName, Src, Tgt, Filter, QueryParams, DocIds]) - end - )), + case proplists:get_value(<<"doc_ids">>, Props) of + undefined -> + []; + DocIds -> + [DocIds] + end; + Filter -> + [Filter, proplists:get_value(<<"query_params">>, Props, {[]})] + end, Extension = maybe_append_options( [<<"continuous">>, <<"create_target">>], Props), - {Base, Extension}. + {couch_util:to_hex(erlang:md5(term_to_binary(Base))), Extension}. maybe_add_trailing_slash(Url) -> re:replace(Url, "[^/]$", "&/", [{return, list}]). -- cgit v1.2.3