@InterfaceAudience.Private public class MasterClusterInfoProvider extends Object implements ClusterInfoProvider
Modifier and Type | Field and Description |
---|---|
private boolean |
isBalancerDecisionRecording |
private boolean |
isBalancerRejectionRecording |
private NamedQueueRecorder |
namedQueueRecorder
Use to add balancer decision history to ring-buffer
|
private OffPeakHours |
offPeakHours |
private MasterServices |
services |
Constructor and Description |
---|
MasterClusterInfoProvider(MasterServices services) |
Modifier and Type | Method and Description |
---|---|
HDFSBlocksDistribution |
computeHDFSBlocksDistribution(org.apache.hadoop.conf.Configuration conf,
TableDescriptor tableDescriptor,
RegionInfo regionInfo)
Compute the block distribution for the given region.
|
List<RegionInfo> |
getAssignedRegions()
Get all the regions of this cluster.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration.
|
Connection |
getConnection()
Returns a reference to the cluster's connection.
|
ServerMetrics |
getLoad(ServerName serverName)
Returns server metrics of the given server if serverName is known else null
|
(package private) NamedQueueRecorder |
getNamedQueueRecorder() |
int |
getNumberOfTables()
Returns the number of tables on this cluster.
|
List<ServerName> |
getOnlineServersList()
Returns a copy of the internal list of online servers.
|
List<ServerName> |
getOnlineServersListWithPredicator(List<ServerName> servers,
Predicate<ServerMetrics> filter)
Returns a copy of the internal list of online servers matched by the given
filter . |
Map<ServerName,List<RegionInfo>> |
getSnapShotOfAssignment(Collection<RegionInfo> regions)
Get a snapshot of the current assignment status.
|
TableDescriptor |
getTableDescriptor(TableName tableName)
Get the table descriptor for the given table.
|
boolean |
hasRegionReplica(Collection<RegionInfo> regions)
Check whether we have region replicas enabled for the tables of the given regions.
|
boolean |
isOffPeakHour()
Test whether we are in off peak hour.
|
private void |
loadConf(org.apache.hadoop.conf.Configuration conf) |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
This method would be called by the
ConfigurationManager object when the
Configuration object is reloaded from disk. |
void |
recordBalancerDecision(Supplier<BalancerDecision> decision)
Record the given balancer decision.
|
void |
recordBalancerRejection(Supplier<BalancerRejection> rejection)
Record the given balancer rejection.
|
void |
unassign(RegionInfo regionInfo)
Unassign the given region.
|
private final MasterServices services
private boolean isBalancerDecisionRecording
private boolean isBalancerRejectionRecording
private NamedQueueRecorder namedQueueRecorder
private OffPeakHours offPeakHours
public MasterClusterInfoProvider(MasterServices services)
private void loadConf(org.apache.hadoop.conf.Configuration conf)
public org.apache.hadoop.conf.Configuration getConfiguration()
ClusterInfoProvider
getConfiguration
in interface ClusterInfoProvider
public Connection getConnection()
ClusterInfoProvider
getConnection
in interface ClusterInfoProvider
public List<RegionInfo> getAssignedRegions()
ClusterInfoProvider
getAssignedRegions
in interface ClusterInfoProvider
public void unassign(RegionInfo regionInfo) throws IOException
ClusterInfoProvider
unassign
in interface ClusterInfoProvider
IOException
public TableDescriptor getTableDescriptor(TableName tableName) throws IOException
ClusterInfoProvider
getTableDescriptor
in interface ClusterInfoProvider
IOException
public HDFSBlocksDistribution computeHDFSBlocksDistribution(org.apache.hadoop.conf.Configuration conf, TableDescriptor tableDescriptor, RegionInfo regionInfo) throws IOException
ClusterInfoProvider
computeHDFSBlocksDistribution
in interface ClusterInfoProvider
IOException
public boolean hasRegionReplica(Collection<RegionInfo> regions) throws IOException
ClusterInfoProvider
hasRegionReplica
in interface ClusterInfoProvider
IOException
public List<ServerName> getOnlineServersList()
ClusterInfoProvider
getOnlineServersList
in interface ClusterInfoProvider
public List<ServerName> getOnlineServersListWithPredicator(List<ServerName> servers, Predicate<ServerMetrics> filter)
ClusterInfoProvider
filter
.getOnlineServersListWithPredicator
in interface ClusterInfoProvider
public Map<ServerName,List<RegionInfo>> getSnapShotOfAssignment(Collection<RegionInfo> regions)
ClusterInfoProvider
getSnapShotOfAssignment
in interface ClusterInfoProvider
public int getNumberOfTables() throws IOException
ClusterInfoProvider
getNumberOfTables
in interface ClusterInfoProvider
IOException
public boolean isOffPeakHour()
ClusterInfoProvider
isOffPeakHour
in interface ClusterInfoProvider
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the
Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
public void recordBalancerDecision(Supplier<BalancerDecision> decision)
ClusterInfoProvider
recordBalancerDecision
in interface ClusterInfoProvider
public void recordBalancerRejection(Supplier<BalancerRejection> rejection)
ClusterInfoProvider
recordBalancerRejection
in interface ClusterInfoProvider
public ServerMetrics getLoad(ServerName serverName)
ClusterInfoProvider
getLoad
in interface ClusterInfoProvider
NamedQueueRecorder getNamedQueueRecorder()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.