Class MasterClusterInfoProvider
java.lang.Object
org.apache.hadoop.hbase.master.balancer.MasterClusterInfoProvider
- All Implemented Interfaces:
ConfigurationObserver
,ClusterInfoProvider
Master based cluster info provider.
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private boolean
private NamedQueueRecorder
Use to add balancer decision history to ring-bufferprivate OffPeakHours
private final MasterServices
-
Constructor Summary
-
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 null(package private) NamedQueueRecorder
int
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.private void
loadConf
(org.apache.hadoop.conf.Configuration conf) void
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
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.
-
Field Details
-
services
-
isBalancerDecisionRecording
-
isBalancerRejectionRecording
-
namedQueueRecorder
Use to add balancer decision history to ring-buffer -
offPeakHours
-
-
Constructor Details
-
MasterClusterInfoProvider
-
-
Method Details
-
loadConf
-
getConfiguration
Description copied from interface:ClusterInfoProvider
Get the configuration.- Specified by:
getConfiguration
in interfaceClusterInfoProvider
-
getConnection
Description copied from interface:ClusterInfoProvider
Returns a reference to the cluster's connection.- Specified by:
getConnection
in interfaceClusterInfoProvider
-
getAssignedRegions
Description copied from interface:ClusterInfoProvider
Get all the regions of this cluster. Used to refresh region block locations on HDFS.- Specified by:
getAssignedRegions
in interfaceClusterInfoProvider
-
unassign
Description copied from interface:ClusterInfoProvider
Unassign the given region.- Specified by:
unassign
in interfaceClusterInfoProvider
- Throws:
IOException
-
getTableDescriptor
Description copied from interface:ClusterInfoProvider
Get the table descriptor for the given table.- Specified by:
getTableDescriptor
in interfaceClusterInfoProvider
- Throws:
IOException
-
computeHDFSBlocksDistribution
public HDFSBlocksDistribution computeHDFSBlocksDistribution(org.apache.hadoop.conf.Configuration conf, TableDescriptor tableDescriptor, RegionInfo regionInfo) throws IOException Description copied from interface:ClusterInfoProvider
Compute the block distribution for the given region. Used to refresh region block locations on HDFS.- Specified by:
computeHDFSBlocksDistribution
in interfaceClusterInfoProvider
- Throws:
IOException
-
hasRegionReplica
Description copied from interface:ClusterInfoProvider
Check whether we have region replicas enabled for the tables of the given regions.- Specified by:
hasRegionReplica
in interfaceClusterInfoProvider
- Throws:
IOException
-
getOnlineServersList
Description copied from interface:ClusterInfoProvider
Returns a copy of the internal list of online servers.- Specified by:
getOnlineServersList
in interfaceClusterInfoProvider
-
getOnlineServersListWithPredicator
public List<ServerName> getOnlineServersListWithPredicator(List<ServerName> servers, Predicate<ServerMetrics> filter) Description copied from interface:ClusterInfoProvider
Returns a copy of the internal list of online servers matched by the givenfilter
.- Specified by:
getOnlineServersListWithPredicator
in interfaceClusterInfoProvider
-
getSnapShotOfAssignment
Description copied from interface:ClusterInfoProvider
Get a snapshot of the current assignment status.- Specified by:
getSnapShotOfAssignment
in interfaceClusterInfoProvider
-
getNumberOfTables
Description copied from interface:ClusterInfoProvider
Returns the number of tables on this cluster.- Specified by:
getNumberOfTables
in interfaceClusterInfoProvider
- Throws:
IOException
-
isOffPeakHour
Description copied from interface:ClusterInfoProvider
Test whether we are in off peak hour. For peak and off peak hours we may have different cost for the same balancing operation.- Specified by:
isOffPeakHour
in interfaceClusterInfoProvider
-
onConfigurationChange
Description copied from interface:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-
recordBalancerDecision
Description copied from interface:ClusterInfoProvider
Record the given balancer decision.- Specified by:
recordBalancerDecision
in interfaceClusterInfoProvider
-
recordBalancerRejection
Description copied from interface:ClusterInfoProvider
Record the given balancer rejection.- Specified by:
recordBalancerRejection
in interfaceClusterInfoProvider
-
getLoad
Description copied from interface:ClusterInfoProvider
Returns server metrics of the given server if serverName is known else null- Specified by:
getLoad
in interfaceClusterInfoProvider
-
getNamedQueueRecorder
-