Package org.apache.hadoop.hbase
Class HDFSBlocksDistribution
java.lang.Object
org.apache.hadoop.hbase.HDFSBlocksDistribution
Data structure to describe the distribution of HDFS blocks among hosts. Adding erroneous data
will be ignored silently.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStores the hostname and weight for that hostname.static interfaceImplementations 'visit' hostAndWeight. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(HDFSBlocksDistribution otherBlocksDistribution) This will add the distribution from input to this objectprivate voidaddHostAndBlockWeight(String host, long weight, long weightForSsd) add some weight to a specific hostvoidaddHostsAndBlockWeight(String[] hosts, long weight) add some weight to a list of hosts, update the value of unique block weightvoidaddHostsAndBlockWeight(String[] hosts, long weight, org.apache.hadoop.fs.StorageType[] storageTypes) add some weight to a list of hosts, update the value of unique block weightprivate voidaddUniqueWeight(long weight) add some weight to the total unique weightfloatgetBlockLocalityIndex(String host) Get the block locality index for a given hostfloatGet the block locality index for a ssd for a given hostprivate longgetBlocksLocalityWeightInternal(String host, HDFSBlocksDistribution.Visitor visitor) longgetBlocksLocalWeight(String host) Get the blocks local weight for a given hostlongGet the blocks local weight with ssd for a given hostReturns the hosts and their weightsReturn the sorted list of hosts in terms of their weightsReturn the sorted list of hosts in terms of their weightslongReturns the sum of all unique blocks' weightlongreturn the weight for a specific host, that will be the total bytes of all blocks on the hosttoString()
-
Field Details
-
hostAndWeights
-
uniqueBlocksTotalWeight
-
-
Constructor Details
-
HDFSBlocksDistribution
public HDFSBlocksDistribution()
-
-
Method Details
-
toString
-
addHostsAndBlockWeight
add some weight to a list of hosts, update the value of unique block weight- Parameters:
hosts- the list of the hostweight- 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 hostweight- the weight
-
addUniqueWeight
add some weight to the total unique weight- Parameters:
weight- the weight
-
addHostAndBlockWeight
add some weight to a specific host- Parameters:
host- the host nameweight- the weightweightForSsd- the weight for ssd
-
getHostAndWeights
Returns the hosts and their weights -
getWeight
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
Get the block locality index for a given host- Parameters:
host- the host name- Returns:
- the locality index of the given host
-
getBlockLocalityIndexForSsd
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
Get the blocks local weight for a given host- Parameters:
host- the host name- Returns:
- the blocks local weight of the given host
-
getBlocksLocalWithSsdWeight
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
This will add the distribution from input to this object- Parameters:
otherBlocksDistribution- the other hdfs blocks distribution
-
getTopHosts
Return the sorted list of hosts in terms of their weights -
getTopHostsWithWeights
Return the sorted list of hosts in terms of their weights
-