Interface ClusterInfoProvider
- All Superinterfaces:
ConfigurationObserver
- All Known Implementing Classes:
MasterClusterInfoProvider
This is the cluster we want to balance. It provides methods to let us get the information we
want.
-
Method Summary
Modifier and TypeMethodDescriptioncomputeHDFSBlocksDistribution
(org.apache.hadoop.conf.Configuration conf, TableDescriptor tableDescriptor, RegionInfo regionInfo) Compute the block distribution for the given region.Get all the regions of this cluster.org.apache.hadoop.conf.Configuration
Get the configuration.Returns a reference to the cluster's connection.getLoad
(ServerName serverName) Returns server metrics of the given server if serverName is known else nullint
Returns the number of tables on this cluster.Returns a copy of the internal list of online servers.getOnlineServersListWithPredicator
(List<ServerName> servers, Predicate<ServerMetrics> filter) Returns a copy of the internal list of online servers matched by the givenfilter
.getSnapShotOfAssignment
(Collection<RegionInfo> regions) Get a snapshot of the current assignment status.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
Test whether we are in off peak hour.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.Methods inherited from interface org.apache.hadoop.hbase.conf.ConfigurationObserver
onConfigurationChange
-
Method Details
-
getConfiguration
org.apache.hadoop.conf.Configuration getConfiguration()Get the configuration. -
getConnection
Returns a reference to the cluster's connection. -
getAssignedRegions
Get all the regions of this cluster. Used to refresh region block locations on HDFS. -
unassign
Unassign the given region.- Throws:
IOException
-
getTableDescriptor
Get the table descriptor for the given table.- Throws:
IOException
-
getNumberOfTables
Returns the number of tables on this cluster.- Throws:
IOException
-
computeHDFSBlocksDistribution
HDFSBlocksDistribution computeHDFSBlocksDistribution(org.apache.hadoop.conf.Configuration conf, TableDescriptor tableDescriptor, RegionInfo regionInfo) throws IOException Compute the block distribution for the given region. Used to refresh region block locations on HDFS.- Throws:
IOException
-
hasRegionReplica
Check whether we have region replicas enabled for the tables of the given regions.- Throws:
IOException
-
getOnlineServersList
Returns a copy of the internal list of online servers. -
getOnlineServersListWithPredicator
List<ServerName> getOnlineServersListWithPredicator(List<ServerName> servers, Predicate<ServerMetrics> filter) Returns a copy of the internal list of online servers matched by the givenfilter
. -
getSnapShotOfAssignment
Get a snapshot of the current assignment status. -
isOffPeakHour
boolean isOffPeakHour()Test whether we are in off peak hour. For peak and off peak hours we may have different cost for the same balancing operation. -
recordBalancerDecision
Record the given balancer decision. -
recordBalancerRejection
Record the given balancer rejection. -
getLoad
Returns server metrics of the given server if serverName is known else null
-