anchor.diff:  all_bucket_dbs(BucketName) ->
       BucketConfig = get_bucket(BucketName),
       NodeVBuckets = ns_bucket:all_node_vbuckets(BucketConfig),
  -    VBucketDbs = [db_name(BucketName, V) || V <- NodeVBuckets],
  -
  -    [db_name(BucketName, "master") | VBucketDbs].
  +    VBucketDbs = [{V, db_name(BucketName, V)} || V <- NodeVBuckets],
  +
  +    [{master, db_name(BucketName, "master")} | VBucketDbs].
   
   get_bucket(BucketName) ->
       get_bucket(BucketName, ns_config:get()).
  
positive.code: 
      {DataSize, FileSize} =
          lists:foldl(
            fun (DbName, {AccDataSize, AccFileSize}) ->
                    {ok, Db} = couch_db:open_int(DbName, []),
  
                    %% unfortunately I can't just bind this inside try block
  
negative.code:            [{vbuckets_done, Ix},
              {progress, Progress}]).
  
  open_db(BucketName, {VBucket, DbName}) ->
      case couch_db:open_int(DbName, []) of
          {ok, Db} ->
              {ok, Db};
          {not_found, no_db_file} = NotFoundError ->
              %% It can be a real error which we don't want to hide. But at the
              %% same time it can be a result of, for instance, rebalance. In
              %% the second case we can expect many databases to be missing. So
              %% we don't want all the resulting harmless errors be spamming the
              %% log. To handle this we will check if the vbucket corresponding
              %% to the database still belongs to our node according to vbucket
              %% map. And if it's not the case we'll indicate that the error can
              %% be ignored.
              case is_integer(VBucket) of
                  true ->
                      BucketConfig = get_bucket(BucketName),
                      NodeVBuckets = ns_bucket:all_node_vbuckets(BucketConfig),
  
                      case ordsets:is_element(VBucket, NodeVBuckets) of
                          true ->
                              %% this is a real error we want to report
                              NotFoundError;
                          false ->
                              vbucket_moved
                      end;
                  false ->
                      NotFoundError
              end;
           Error ->
              Error
      end.
  
  open_db_or_fail(BucketName, {_, DbName} = VBucketAndDbName) ->
      case open_db(BucketName, VBucketAndDbName) of
          {ok, Db} ->
              Db;
          vbucket_moved ->
              exit(normal);
          Error ->
              ?log_error("Failed to open database `~s`: ~p", [DbName, Error]),
              exit({open_db_failed, Error})
      end.
  
  spawn_vbucket_compactor(BucketName, {_, DbName} = VBucketAndDb) ->
      Parent = self(),
  
      proc_lib:spawn_link(
        fun () ->
                Db = open_db_or_fail(BucketName, VBucketAndDb),
  
                %% effectful
                ensure_can_db_compact(Db),
  