anchor.diff:      PauseVBuckets = [VBucket
                        || {VBucket, WantedState, TmpState} <- Triples,
                           TmpState =:= paused,
  -                        sets:is_element(VBucket, ExistingVBuckets),
                           begin
                               active = WantedState,
                               true
                           end],
       UnpauseVBuckets = ordsets:subtract(AllVBs, PauseVBuckets),
       {Active, Passive, MainCleanup, Replica, ReplicaCleanup, PauseVBuckets, UnpauseVBuckets}.
  -
  -get_usable_vbuckets_set(Bucket) ->
  -    PrefixLen = erlang:length(Bucket) + 1,
  -    sets:from_list(
  -      [list_to_integer(binary_to_list(VBucketName))
  -       || FullName <- ns_storage_conf:bucket_databases(Bucket),
  -          <<_:PrefixLen/binary, VBucketName/binary>> <- [FullName],
  -          VBucketName =/= <<"master">>]).
   
   do_apply_vbucket_states(SetName, Active, Passive, MainCleanup, Replica, ReplicaCleanup, PauseVBuckets, UnpauseVBuckets, State) ->
       DDocIds = get_live_ddoc_ids(State),
  
positive.code:           end)())).
  
  
  compute_index_states(WantedStates, RebalanceStates, ExistingVBuckets) ->
      AllVBs = lists:seq(0, erlang:length(WantedStates)-1),
      Triples = lists:zip3(AllVBs,
                           WantedStates,
                           RebalanceStates),
      % Ensure Active, Passive and Replica are ordsets
      {Active, Passive, Replica} = lists:foldr(
                                     fun ({VBucket, WantedState, TmpState}, {AccActive, AccPassive, AccReplica}) ->
                                             case sets:is_element(VBucket, ExistingVBuckets) of
                                                 true ->
                                                     case {WantedState, TmpState} of
                                                         %% {replica, passive} ->
                                                         %%     {AccActibe, [VBucket | AccPassive], [VBucket | AccReplica]};
                                                         {_, passive} ->
                                                             {AccActive, [VBucket | AccPassive], AccReplica};
                                                         {active, _} ->
                                                             {[VBucket | AccActive], AccPassive, AccReplica};
                                                         {replica, _} ->
                                                             {AccActive, AccPassive, [VBucket | AccReplica]};
                                                         _ ->
                                                             {AccActive, AccPassive, AccReplica}
                                                     end;
                                                 false ->
                                                     {AccActive, AccPassive, AccReplica}
                                             end
                                     end,
  
negative.code: 
  handle_call({delete_vbucket, VBucket}, _From, #state{bucket = Bucket,
                                                       wanted_states = [],
                                                       rebalance_states = RebalanceStates} = State) ->
      [] = RebalanceStates,
      ?log_info("Deleting vbucket ~p from all indexes", [VBucket]),
      SetName = list_to_binary(Bucket),
      do_apply_vbucket_states(SetName, [], [], [VBucket], [], [VBucket], [], [], State),
      {reply, ok, State};
  handle_call({delete_vbucket, VBucket}, _From,
              #state{wanted_states = WantedStates,
                     rebalance_states = RebalanceStates} = State) ->
      NewWantedStates = misc:nthreplace(VBucket + 1, missing, WantedStates),
      NewRebalanceStates = misc:nthreplace(VBucket + 1, undefined, RebalanceStates),
  
      case NewWantedStates =:= WantedStates
          andalso NewRebalanceStates =:= RebalanceStates of
          true ->
              %% skipping vbucket changes pass iff it's totally
              %% uninteresting vbucket
              {reply, ok, State};
          false ->
              NewState = State#state{wanted_states = NewWantedStates,
                                     rebalance_states = NewRebalanceStates},
              change_vbucket_states(NewState),
              {reply, ok, NewState}
      end;
  handle_call(reset_master_vbucket, _From, #state{bucket = Bucket,
  