From 99a64b2508e815e5a820c802b0d9c802659e72d3 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Tue, 27 Mar 2018 10:55:48 -0500 Subject: Fix shard substitution in changes feeds --- src/mem3/src/mem3_rep.erl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mem3/src/mem3_rep.erl b/src/mem3/src/mem3_rep.erl index 942f8a8e0..3d9187796 100644 --- a/src/mem3/src/mem3_rep.erl +++ b/src/mem3/src/mem3_rep.erl @@ -341,14 +341,12 @@ find_repl_doc(SrcDb, TgtUUIDPrefix) -> SrcUUID = couch_db:get_uuid(SrcDb), S = couch_util:encodeBase64Url(crypto:hash(md5, term_to_binary(SrcUUID))), DocIdPrefix = <<"_local/shard-sync-", S/binary, "-">>, - FoldFun = fun({DocId, {Rev0, {BodyProps}}}, _) -> + FoldFun = fun(#doc{id = DocId, body = {BodyProps}} = Doc, _) -> TgtUUID = couch_util:get_value(<<"target_uuid">>, BodyProps, <<>>), case is_prefix(DocIdPrefix, DocId) of true -> case is_prefix(TgtUUIDPrefix, TgtUUID) of true -> - Rev = list_to_binary(integer_to_list(Rev0)), - Doc = #doc{id=DocId, revs={0, [Rev]}, body={BodyProps}}, {stop, {TgtUUID, Doc}}; false -> {ok, not_found} -- cgit v1.2.1