Class HDFSBlocksDistribution

java.lang.Object
org.apache.hadoop.hbase.HDFSBlocksDistribution

@Private public class HDFSBlocksDistribution extends Object
Data structure to describe the distribution of HDFS blocks among hosts. Adding erroneous data will be ignored silently.
  • Field Details

  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addHostsAndBlockWeight

      public void addHostsAndBlockWeight(String[] hosts, long weight)
      add some weight to a list of hosts, update the value of unique block weight
      Parameters:
      hosts - the list of the host
      weight - the weight
    • addHostsAndBlockWeight

      public void addHostsAndBlockWeight(String[] hosts, long weight, org.apache.hadoop.fs.StorageType[] storageTypes)
      add some weight to a list of hosts, update the value of unique block weight
      Parameters:
      hosts - the list of the host
      weight - the weight
    • addUniqueWeight

      private void addUniqueWeight(long weight)
      add some weight to the total unique weight
      Parameters:
      weight - the weight
    • addHostAndBlockWeight

      private void addHostAndBlockWeight(String host, long weight, long weightForSsd)
      add some weight to a specific host
      Parameters:
      host - the host name
      weight - the weight
      weightForSsd - the weight for ssd
    • getHostAndWeights

      Returns the hosts and their weights
    • getWeight

      public long getWeight(String host)
      return the weight for a specific host, that will be the total bytes of all blocks on the host
      Parameters:
      host - the host name
      Returns:
      the weight of the given host
    • getUniqueBlocksTotalWeight

      Returns the sum of all unique blocks' weight
    • getBlockLocalityIndex

      public float getBlockLocalityIndex(String host)
      Get the block locality index for a given host
      Parameters:
      host - the host name
      Returns:
      the locality index of the given host
    • getBlockLocalityIndexForSsd

      public float getBlockLocalityIndexForSsd(String host)
      Get the block locality index for a ssd for a given host
      Parameters:
      host - the host name
      Returns:
      the locality index with ssd of the given host
    • getBlocksLocalWeight

      public long getBlocksLocalWeight(String host)
      Get the blocks local weight for a given host
      Parameters:
      host - the host name
      Returns:
      the blocks local weight of the given host
    • getBlocksLocalWithSsdWeight

      public long getBlocksLocalWithSsdWeight(String host)
      Get the blocks local weight with ssd for a given host
      Parameters:
      host - the host name
      Returns:
      the blocks local with ssd weight of the given host
    • getBlocksLocalityWeightInternal

    • add

      public void add(HDFSBlocksDistribution otherBlocksDistribution)
      This will add the distribution from input to this object
      Parameters:
      otherBlocksDistribution - the other hdfs blocks distribution
    • getTopHosts

      public List<String> getTopHosts()
      Return the sorted list of hosts in terms of their weights
    • getTopHostsWithWeights

      Return the sorted list of hosts in terms of their weights