anchor.diff:  
       file_needs_compaction(DataSize, FileSize, FragThreshold, MinFileSize).
   
  -get_master_db_size_info(BucketName, VBucketAndDb) ->
  -    Db = open_db_or_fail(BucketName, VBucketAndDb),
  +get_master_db_size_info(DbName) ->
  +    Db = open_db_or_fail(DbName),
   
       try
           {ok, DbInfo} = couch_db:get_db_info(Db),
  
positive.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})
  
negative.code:               end
        end).
  
  compact_master_vbucket(DbName) ->
      Db = open_db_or_fail(DbName),
      process_flag(trap_exit, true),
  
      {ok, Compactor} = couch_db:start_compact(Db, [dropdeletes]),
  