anchor.diff:      case {SrcBucketLookup, TgtBucketLookup} of
       {not_present, not_present} ->
           ?log_error("~s: source and target buckets not found", [XDocId]),
  -        true = ets:insert(?XSTORE, {XDocId, XRep, []}),
  +        true = ets:insert(?XSTORE, {XDocId, XRep, [], []}),
           {error, not_present};
       {not_present, _} ->
           ?log_error("~s: source bucket not found", [XDocId]),
  -        true = ets:insert(?XSTORE, {XDocId, XRep, []}),
  +        true = ets:insert(?XSTORE, {XDocId, XRep, [], []}),
           {error, not_present};
       {_, not_present} ->
           ?log_error("~s: target bucket not found", [XDocId]),
  -        true = ets:insert(?XSTORE, {XDocId, XRep, []}),
  +        true = ets:insert(?XSTORE, {XDocId, XRep, [], []}),
           {error, not_present};
       {{ok, SrcBucketConfig}, {ok, {TgtVbMap, TgtNodes}}} ->
  -        MyVbuckets = xdc_rep_utils:my_active_vbuckets(SrcBucketConfig),
  -        {TriggeredVbuckets, _} = start_vbucket_replications(
  -            XDocId, SrcBucket, TgtVbMap, TgtNodes, MyVbuckets, 0),
  -        true = ets:insert(?XSTORE, {XDocId, XRep, TriggeredVbuckets}),
  -        create_xdc_rep_info_doc(XDocId, XRepId, TriggeredVbuckets, RepDbName,
  +        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, RepDbName,
                                   XDocBody),
           ok
       end.
  
positive.code: %
  % The XRM maintains local state about all in-progress replications and
  % comprises of the following data structures:
  % XSTORE: An ETS set of {XDocId, XRep, Vbuckets} tuples
  %         XDocId: Id of a user created XDC replication document
  %         XRep: The parsed #rep record for the document
  %         Vbuckets: The list of managed active vbuckets
  %                   (useful for responding to vbucket map changes)
  %
  % X2CSTORE: An ETS bag of {XDocId, CRepPid} tuples
  %           CRepPid: Pid of the Couch process responsible for an individual
  
negative.code:     lists:map(
          fun([XDocId,
               #rep{source = SrcBucket,
                    target = {_, TgtBucket, _, _, _, _, _, _, _, _}},
               TriggeredVbs, UntriggeredVbs]) ->
  
              FailedCouchReps = failed_couch_replications(XDocId),
              case {FailedCouchReps, UntriggeredVbs} of
              {[], []} ->
                  ?log_info("~s: no failed vbucket replications found", [XDocId]);
              {_, _} ->
                  % Reread the target vbucket map once before retrying all reps
                  {ok, {TgtVbMap, TgtNodes} = TgtVbInfo} =
                      xdc_rep_utils:remote_vbucketmap_nodelist(TgtBucket),
  
                  % Retry couch replications that failed after they were triggered
                  lists:map(
                      fun(FailedCouchRep) ->
                          retry_couch_replication(XDocId, SrcBucket, TgtVbInfo,
                                                  FailedCouchRep)
                      end,
                      FailedCouchReps),
  
                  % Retry couch replications that did not trigger at all
                  {TriggeredVbs1, UntriggeredVbs1} = start_vbucket_replications(
                      XDocId, SrcBucket, TgtVbMap, TgtNodes, UntriggeredVbs, 0),
                  true = ets:update_element(
                      ?XSTORE, XDocId, [{3, (TriggeredVbs ++ TriggeredVbs1)},
                                        {4, UntriggeredVbs1}])
              end
          end,
          ets:match(?XSTORE, {'$1', '$2', '$3', '$4'})).
  
  
  retry_couch_replication(XDocId,
  