anchor.diff:              fun(Vb) ->
                   {?l2b("replication_state_vb_" ++ ?i2l(Vb)), <<"triggered">>}
               end,
  -            VbucketsAcquired)),
  +            (AcquiredVbuckets -- FailedVbuckets))),
   
       % Cancel Couch replications for the lost vbuckets
       CRepPidsToCancel =
           try
               [CRepPid || CRepPid <- ets:lookup_element(?X2CSTORE, XDocId, 2),
                           lists:member(ets:lookup_element(?CSTORE, CRepPid, 3),
  -                                     VbucketsLost)]
  +                                     LostVbuckets)]
           catch error:badarg ->
               []
           end,
  
positive.code:             fun(Vb) ->
                  {?l2b("replication_state_vb_" ++ ?i2l(Vb)), <<"cancelled">>}
              end,
              VbucketsLost)),
  
      % Update XSTORE with the current active vbuckets list
      true = ets:update_element(?XSTORE, XDocId, {3, CurrVbuckets}).
  
  
  %
  
negative.code: 
  maybe_adjust_xdc_replication(XDocId, SrcBucket, TgtBucket, PrevVbuckets,
                               CurrVbuckets) ->
      {AcquiredVbuckets, LostVbuckets} =
          xdc_rep_utils:lists_difference(CurrVbuckets, PrevVbuckets),
  
      % Start Couch replications for the newly acquired vbuckets
      {ok, {TgtVbMap, TgtNodes}} =
          xdc_rep_utils:remote_vbucketmap_nodelist(TgtBucket),
      FailedVbuckets = lists:foldl(
          fun(Vb, VbList) ->
              SrcURI = xdc_rep_utils:local_couch_uri_for_vbucket(SrcBucket, Vb),
              TgtURI = xdc_rep_utils:remote_couch_uri_for_vbucket(
                  TgtVbMap, TgtNodes, Vb),
              case start_couch_replication(SrcURI, TgtURI, Vb, XDocId, 0) of
              {ok, _Res} ->
                  VbList;
              _Error ->
                  VbList ++ [Vb]
              end
          end,
          [], AcquiredVbuckets),
  
      % Add entries for the new Couch replications to the replication info doc
      couch_replication_manager:update_rep_doc(
  