anchor.diff:                (_, _) ->
                     throw(unsupported)
             end, [], JsonDocIdRevs),
  +
  +    NumCandidates = length(JsonDocIdRevs),
  +    RemoteWinners = length(Results),
  +    ?xdcr_debug("after conflict resolution for ~p docs, num of remote winners is ~p and "
  +                "number of local winners is ~p.",
  +                [NumCandidates, RemoteWinners, (NumCandidates-RemoteWinners)]),
       {ok, Results}.
   
  -is_missing_rev(Bucket, VBucket, Id, RemoteMeta) ->
  -     case capi_utils:get_meta(Bucket, VBucket, Id) of
  -         {error, enoent, _CAS} ->
  -             true;
  -         {error, not_my_vbucket} ->
  -             throw({bad_request, not_my_vbucket});
  -         {ok, LocalMeta, _Deleted, _Props} ->
  -             %% we do not have any information about deletedness of
  -             %% the remote side thus we use only revisions to
  -             %% determine a winner
  -             case max(LocalMeta, RemoteMeta) of
  -                 %% if equal, prefer LocalMeta since in this case, no need
  -                 %% to replicate the remote item, hence put LocalMeta before
  -                 %% RemoteMeta.
  -                 LocalMeta ->
  -                     false;
  -                 RemoteMeta ->
  -                     true
  -             end
  -     end.
  -
  -
  -%% In case of one or more errors, just return the first one. Otherwise,
  -%% return ok. Also notice that in case of error, we return {ok, Error}. This is
  -%% per the Couch's update_docs() semantics.
  -make_return_tuple({ok, Errors}) ->
  -    case Errors of
  -        [] ->
  -            ok;
  -        [Error | _] ->
  -            {ok, Error}
  -    end.
  -
  -update_replicated_docs(#db{name = BucketBin,
  -                           filepath = undefined},
  -                       Docs, Options) ->
  -    Bucket = binary_to_list(BucketBin),
  -
  -    case proplists:get_value(all_or_nothing, Options, false) of
  -        true ->
  -            throw(unsupported);
  -        false ->
  -            ok
  -    end,
  -
  -    Errors =
  -        lists:foldr(
  -          fun (#doc{id = Id, rev = Rev} = Doc, ErrorsAcc) ->
  -                  {VBucket, _Node} = cb_util:vbucket_from_id(Bucket, Id),
  -
  -                  case do_update_replicated_doc(Bucket, VBucket, Doc) of
  -                      ok ->
  -                          ErrorsAcc;
  -                      {error, Error} ->
  -                          [{{Id, Rev}, Error} | ErrorsAcc]
  -                  end
  -          end,
  -          [], Docs),
  -
  -    make_return_tuple({ok, Errors});
   update_replicated_docs(#db{name = DbName}, Docs, Options) ->
       {Bucket, VBucket} = capi_utils:split_dbname(DbName),
   
  
positive.code:     Errors =
          lists:foldr(
            fun (#doc{id = Id, rev = Rev} = Doc, ErrorsAcc) ->
                    case do_update_replicated_doc(Bucket, VBucket, Doc) of
                        ok ->
                            ErrorsAcc;
                        {error, Error} ->
  
negative.code:             {error, {bad_request, einval}}
      end.
  
  