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
Modifier and TypeClassDescriptionstatic class
Stores the hostname and weight for that hostname.static interface
Implementations 'visit' hostAndWeight. -
Field Summary
Modifier and TypeFieldDescriptionprivate long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(HDFSBlocksDistribution otherBlocksDistribution) This will add the distribution from input to this objectprivate void
addHostAndBlockWeight
(String host, long weight, long weightForSsd) add some weight to a specific hostvoid
addHostsAndBlockWeight
(String[] hosts, long weight) add some weight to a list of hosts, update the value of unique block weightvoid
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 weightprivate void
addUniqueWeight
(long weight) add some weight to the total unique weightfloat
getBlockLocalityIndex
(String host) Get the block locality index for a given hostfloat
Get the block locality index for a ssd for a given hostprivate long
getBlocksLocalityWeightInternal
(String host, HDFSBlocksDistribution.Visitor visitor) long
getBlocksLocalWeight
(String host) Get the blocks local weight for a given hostlong
Get 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 weightslong
Returns the sum of all unique blocks' weightlong
return 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
-