@InterfaceAudience.Private class RegionLocationFinder extends Object
ServerName
's by the
size of the store files they are holding for a given region.Modifier and Type | Field and Description |
---|---|
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> |
cache |
private static long |
CACHE_TIME |
private org.apache.hadoop.conf.Configuration |
conf |
private static HDFSBlocksDistribution |
EMPTY_BLOCK_DISTRIBUTION |
private static float |
EPSILON |
private org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService |
executor |
private long |
lastFullRefresh |
private org.apache.hbase.thirdparty.com.google.common.cache.CacheLoader<RegionInfo,HDFSBlocksDistribution> |
loader |
private static org.slf4j.Logger |
LOG |
private MasterServices |
services |
private ClusterMetrics |
status |
Constructor and Description |
---|
RegionLocationFinder() |
Modifier and Type | Method and Description |
---|---|
private org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture<HDFSBlocksDistribution> |
asyncGetBlockDistribution(RegionInfo hri) |
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> |
createCache()
Create a cache for region to list of servers
|
HDFSBlocksDistribution |
getBlockDistribution(RegionInfo hri) |
(package private) org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> |
getCache() |
org.apache.hadoop.conf.Configuration |
getConf() |
private float |
getOldLocality(ServerName newServer,
byte[] regionName,
Map<ServerName,ServerMetrics> oldServers) |
protected TableDescriptor |
getTableDescriptor(TableName tableName)
return TableDescriptor for a given tableName
|
protected List<ServerName> |
getTopBlockLocations(RegionInfo region) |
protected List<ServerName> |
getTopBlockLocations(RegionInfo region,
String currentHost)
Returns an ordered list of hosts which have better locality for this region than the current
host.
|
protected HDFSBlocksDistribution |
internalGetTopBlockLocation(RegionInfo region)
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.
|
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 |
scheduleFullRefresh()
Refresh all the region locations.
|
void |
setClusterMetrics(ClusterMetrics status) |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
setServices(MasterServices services) |
private static final org.slf4j.Logger LOG
private static final long CACHE_TIME
private static final float EPSILON
private static final HDFSBlocksDistribution EMPTY_BLOCK_DISTRIBUTION
private org.apache.hadoop.conf.Configuration conf
private volatile ClusterMetrics status
private MasterServices services
private final org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListeningExecutorService executor
private long lastFullRefresh
private org.apache.hbase.thirdparty.com.google.common.cache.CacheLoader<RegionInfo,HDFSBlocksDistribution> loader
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> cache
RegionLocationFinder()
private org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> createCache()
public org.apache.hadoop.conf.Configuration getConf()
public void setConf(org.apache.hadoop.conf.Configuration conf)
public void setServices(MasterServices services)
public void setClusterMetrics(ClusterMetrics status)
private void refreshLocalityChangedRegions(ClusterMetrics oldStatus, ClusterMetrics newStatus)
private float getOldLocality(ServerName newServer, byte[] regionName, Map<ServerName,ServerMetrics> oldServers)
private boolean scheduleFullRefresh()
protected List<ServerName> getTopBlockLocations(RegionInfo region)
protected List<ServerName> getTopBlockLocations(RegionInfo region, String currentHost)
protected HDFSBlocksDistribution internalGetTopBlockLocation(RegionInfo region)
region
- regionprotected TableDescriptor getTableDescriptor(TableName tableName) throws IOException
tableName
- the table name nnIOException
List<ServerName> mapHostNameToServerName(List<String> hosts)
hosts
- the list of hostspublic HDFSBlocksDistribution getBlockDistribution(RegionInfo hri)
private org.apache.hbase.thirdparty.com.google.common.util.concurrent.ListenableFuture<HDFSBlocksDistribution> asyncGetBlockDistribution(RegionInfo hri)
public void refreshAndWait(Collection<RegionInfo> hris)
org.apache.hbase.thirdparty.com.google.common.cache.LoadingCache<RegionInfo,HDFSBlocksDistribution> getCache()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.