anchor.diff:              %% alive. Eventually we will get a notification from master db
               %% watcher and delete it from a list of design documents.
               ok
  -    end.
  +    end,
  +
  +    apply_ddoc_map(Bucket, DDocId, undefined, Map).
   
   maybe_define_group(Bucket, BucketConfig, DDocId, Map) ->
       try
  
positive.code:             ok
      end.
  
  apply_ddoc_map(Bucket, DDocId, Active, Passive, ToRemove) ->
      SetName = list_to_binary(Bucket),
  
      try
          ok = couch_set_view:set_partition_states(SetName, DDocId,
                                                   Active, Passive, ToRemove)
      catch
          throw:{not_found, deleted} ->
              %% The document has been deleted but we still think it's
  
negative.code:     end.
  
  apply_map(Bucket, DDocs, OldMap, NewMap) ->
      ?log_info("Applying map to bucket ~s:~n~p", [Bucket, NewMap]),
  
      {Active, Passive, Cleanup, Replica, ReplicaCleanup} =
          classify_vbuckets(OldMap, NewMap),
  
      ?log_info("Classified vbuckets for ~s:~n"
                "Active: ~p~n"
                "Passive: ~p~n"
                "Cleanup: ~p~n"
                "Replica: ~p~n"
                "ReplicaCleanup: ~p",
                [Bucket, Active, Passive, Cleanup, Replica, ReplicaCleanup]),
  
      sets:fold(
        fun (DDocId, _) ->
                apply_ddoc_map(Bucket, DDocId,
                               Active, Passive, Cleanup, Replica, ReplicaCleanup)
        end, undefined, DDocs).
  
  get_vbucket_state(Bucket, VBucket) ->
  