anchor.diff:              case ns_bucket:bucket_type(BucketConfig) of
                   membase ->
                       dcp = ns_bucket:replication_type(BucketConfig),
  -                    cleanup_with_membase_bucket_check_servers(Bucket, Options,
  -                                                              BucketConfig, FullConfig);
  +                    cleanup_membase_bucket(Bucket,
  +                                           Options, BucketConfig, FullConfig);
                   _ -> ok
               end
       end.
  +
  +cleanup_membase_bucket(Bucket, Options, BucketConfig, FullConfig) ->
  +    {ok, RV} =
  +        leader_activities:run_activity(
  +          {ns_janitor, Bucket, cleanup}, majority,
  +          fun () ->
  +                  {ok, cleanup_with_membase_bucket_check_servers(Bucket,
  +                                                                 Options,
  +                                                                 BucketConfig,
  +                                                                 FullConfig)}
  +          end,
  +          [quiet]),
  +
  +    RV.
   
   cleanup_with_membase_bucket_check_servers(Bucket, Options, BucketConfig, FullConfig) ->
       case compute_servers_list_cleanup(BucketConfig, FullConfig) of
  
positive.code:     end,
  
      ns_bucket:set_map(Bucket, Map),
      ns_bucket:set_map_opts(Bucket, Opts).
  
  cleanup_with_membase_bucket_vbucket_map(Bucket, Options, BucketConfig) ->
      Servers = proplists:get_value(servers, BucketConfig, []),
  
negative.code:         true ->
              ok;
          false ->
              fixup_vbucket_map(Bucket, BucketConfig, NewBucketConfig, States)
      end,
  
      {NewBucketConfig, IgnoredVBuckets}.
  
  fixup_vbucket_map(Bucket, BucketConfig, NewBucketConfig, States) ->
      ?log_info("Janitor is going to change "
                "bucket config for bucket ~p", [Bucket]),
      ?log_info("VBucket states:~n~p", [States]),
      ?log_info("Old bucket config:~n~p", [BucketConfig]),
  
      ok = ns_bucket:set_bucket_config(Bucket, NewBucketConfig),
      ok = ns_config_rep:ensure_config_seen_by_nodes().
  
  cleanup_apply_config(Bucket,
                       Servers, BucketConfig, IgnoredVBuckets, Options) ->
      {ok, Result} =
          leader_activities:run_activity(
            {ns_janitor, Bucket, apply_config}, {all, Servers},
            fun () ->
                    {ok, cleanup_apply_config_body(Bucket,
                                                   Servers, BucketConfig,
                                                   IgnoredVBuckets, Options)}
            end,
            [quiet]),
  
      Result.
  
  cleanup_apply_config_body(Bucket, Servers,
                            BucketConfig, IgnoredVBuckets, Options) ->
      ApplyTimeout = proplists:get_value(apply_config_timeout,
                                         Options,
                                         undefined_timeout),
  