Class RegionHDFSBlockLocationFinder
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.hbase.master.balancer.RegionHDFSBlockLocationFinder
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
This will find where data for a region is located in HDFS. It ranks
ServerName
's by the
size of the store files they are holding for a given region.-
Field Summary
Modifier and TypeFieldDescriptionprivate org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,
HDFSBlocksDistribution> private static final long
private static final HDFSBlocksDistribution
private static final float
private final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService
private long
private org.apache.hbase.thirdparty.com.google.common.cache.CacheLoader<RegionInfo,
HDFSBlocksDistribution> private static final org.slf4j.Logger
private ClusterInfoProvider
private ClusterMetrics
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture<HDFSBlocksDistribution>
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,
HDFSBlocksDistribution> Create a cache for region to list of servers(package private) HDFSBlocksDistribution
(package private) org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,
HDFSBlocksDistribution> getCache()
private TableDescriptor
getDescriptor
(TableName tableName) return TableDescriptor for a given tableNameprivate float
getOldLocality
(ServerName newServer, byte[] regionName, Map<ServerName, ServerMetrics> oldServers) (package private) List<ServerName>
getTopBlockLocations
(RegionInfo region) private HDFSBlocksDistribution
Returns an ordered list of hosts that are hosting the blocks for this region.(package private) List<ServerName>
mapHostNameToServerName
(List<String> hosts) Map hostname to ServerName, The output ServerName list will have the same order as input hosts.(package private) void
refreshAndWait
(Collection<RegionInfo> hris) private void
refreshLocalityChangedRegions
(ClusterMetrics oldStatus, ClusterMetrics newStatus) If locality for a region has changed, that pretty certainly means our cache is out of date.private boolean
Refresh all the region locations.(package private) void
setClusterInfoProvider
(ClusterInfoProvider provider) (package private) void
setClusterMetrics
(ClusterMetrics status) Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConf
-
Field Details
-
LOG
-
CACHE_TIME
- See Also:
-
EPSILON
- See Also:
-
EMPTY_BLOCK_DISTRIBUTION
-
status
-
provider
-
executor
private final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService executor -
lastFullRefresh
-
loader
private org.apache.hbase.thirdparty.com.google.common.cache.CacheLoader<RegionInfo,HDFSBlocksDistribution> loader -
cache
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> cache
-
-
Constructor Details
-
RegionHDFSBlockLocationFinder
-
-
Method Details
-
createCache
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> createCache()Create a cache for region to list of servers- Returns:
- A new Cache.
-
setClusterInfoProvider
-
setClusterMetrics
-
refreshLocalityChangedRegions
If locality for a region has changed, that pretty certainly means our cache is out of date. Compare oldStatus and newStatus, refreshing any regions which have moved or changed locality. -
getOldLocality
private float getOldLocality(ServerName newServer, byte[] regionName, Map<ServerName, ServerMetrics> oldServers) -
scheduleFullRefresh
Refresh all the region locations.- Returns:
- true if user created regions got refreshed.
-
getTopBlockLocations
-
internalGetTopBlockLocation
Returns an ordered list of hosts that are hosting the blocks for this region. The weight of each host is the sum of the block lengths of all files on that host, so the first host in the list is the server which holds the most bytes of the given region's HFiles.- Parameters:
region
- region- Returns:
- ordered list of hosts holding blocks of the specified region
-
getDescriptor
return TableDescriptor for a given tableName- Parameters:
tableName
- the table name- Throws:
IOException
-
mapHostNameToServerName
Map hostname to ServerName, The output ServerName list will have the same order as input hosts.- Parameters:
hosts
- the list of hosts- Returns:
- ServerName list
-
getBlockDistribution
-
asyncGetBlockDistribution
private org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture<HDFSBlocksDistribution> asyncGetBlockDistribution(RegionInfo hri) -
refreshAndWait
-
getCache
org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> getCache()
-