anchor.diff:          ?log_error("~s: target bucket not found", [XDocId]),
           true = ets:insert(?XSTORE, {XDocId, XRep, [], []}),
           {error, not_present};
  -    {{ok, SrcBucketConfig}, {ok, {TgtVbMap, TgtNodes}}} ->
  +    {{ok, SrcBucketConfig}, _} ->
           MyVbs = xdc_rep_utils:my_active_vbuckets(SrcBucketConfig),
  -        {TriggeredVbs, UntriggeredVbs} = start_vbucket_replications(
  -            XDocId, SrcBucket, TgtVbMap, TgtNodes, MyVbs, 0),
  -        true = ets:insert(?XSTORE, {XDocId, XRep, TriggeredVbs,
  -                                    UntriggeredVbs}),
  -        create_xdc_rep_info_doc(XDocId, XRepId, TriggeredVbs, UntriggeredVbs,
  -                                RepDbName, XDocBody),
  +        true = ets:insert(?XSTORE, {XDocId, XRep, MyVbs}),
  +        create_xdc_rep_info_doc(XDocId, XRepId, MyVbs, RepDbName, XDocBody),
           ok
       end.
   
  
positive.code: 
  maybe_adjust_all_replications(BucketConfigs) ->
      lists:foreach(
          fun([XDocId,
               #rep{source = SrcBucket,
                    target = {_, TgtBucket, _, _, _, _, _, _, _, _}},
               PrevTriggeredVbs,
               PrevUntriggeredVbs]) ->
              SrcBucketConfig =
                  proplists:get_value(?b2l(SrcBucket), BucketConfigs),
              CurrVbs = xdc_rep_utils:my_active_vbuckets(SrcBucketConfig),
              maybe_adjust_xdc_replication(
                  XDocId, SrcBucket, TgtBucket, PrevTriggeredVbs,
                  PrevUntriggeredVbs, CurrVbs)
          end,
          ets:match(?XSTORE, {'$1', '$2', '$3', '$4'})).
  
  
  maybe_adjust_xdc_replication(XDocId, SrcBucket, TgtBucket, PrevTriggeredVbs,
                               PrevUntriggeredVbs, CurrVbs) ->
      PrevVbs = PrevTriggeredVbs ++ PrevUntriggeredVbs,
      {AcquiredVbs, LostVbs} = xdc_rep_utils:lists_difference(CurrVbs, PrevVbs),
  
      % Start Couch replications for the newly acquired vbuckets
      {ok, {TgtVbMap, TgtNodes}} =
          xdc_rep_utils:remote_vbucketmap_nodelist(TgtBucket),
      {TriggeredVbs1, UntriggeredVbs1} = start_vbucket_replications(
          XDocId, SrcBucket, TgtVbMap, TgtNodes, AcquiredVbs, 0),
  
      % Add entries for the new Couch replications to the replication info doc
      couch_replication_manager:update_rep_doc(
          xdc_rep_utils:info_doc_id(XDocId),
          xdc_rep_utils:vb_rep_state_list(TriggeredVbs1, <<"triggered">>)),
  
      % Cancel Couch replications for the lost vbuckets
      CRepPidsToCancel =
  
negative.code:         xdc_rep_utils:vb_rep_state_list(LostVbs, <<"cancelled">>)),
  
      % Update XSTORE with the current active vbuckets list
      true = ets:update_element(?XSTORE, XDocId, [{3, CurrVbs}]).
  
  
  start_vbucket_replication(XDocId, SrcBucket, {TgtVbMap, TgtNodes}, Vb) ->
      SrcURI = xdc_rep_utils:local_couch_uri_for_vbucket(SrcBucket, Vb),
      TgtURI = xdc_rep_utils:remote_couch_uri_for_vbucket(TgtVbMap, TgtNodes, Vb),
      start_couch_replication(SrcURI, TgtURI, Vb, XDocId).
  
  
  restart_vbucket_replication(XDocId, SrcBucket, TgtVbInfo, Vb, CRepPid) ->
      cancel_couch_replication(XDocId, CRepPid),
      start_vbucket_replication(XDocId, SrcBucket, TgtVbInfo, Vb).
  
  %
  % Couch specific functions
  %
  
  start_couch_replication(SrcCouchURI, TgtCouchURI, Vb, XDocId) ->
      % Until scheduled XDC replication support is added, this function will
      % trigger continuous replication by default at the Couch level.
      {ok, CRep} =
  