public static class TestAssignmentManager.MockedLoadBalancer extends SimpleLoadBalancer
BaseLoadBalancer.Cluster
clusterStatus, config, masterServerName, metricsBalancer, rackManager, regionFinder, services, slop, TABLES_ON_MASTER, tablesOnMaster
Constructor and Description |
---|
MockedLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
ServerName |
randomAssignment(HRegionInfo regionInfo,
List<ServerName> servers)
Used to assign a single region to a random server.
|
Map<ServerName,List<HRegionInfo>> |
retainAssignment(Map<HRegionInfo,ServerName> regions,
List<ServerName> servers)
Generates a bulk assignment startup plan, attempting to reuse the existing
assignment information from META, but adjusting for the specified list of
available/online servers available for assignment.
|
void |
setGateVariable(AtomicBoolean gate) |
balanceCluster
areSomeRegionReplicasColocated, assignMasterRegions, balanceMasterRegions, createCluster, getConf, getRegionAssignmentsByServer, getTablesOnMaster, immediateAssignment, initialize, isStopped, needsBalance, onConfigurationChange, regionOffline, regionOnline, roundRobinAssignment, setClusterStatus, setConf, setMasterServices, setRackManager, setSlop, shouldBeOnMaster, stop, tablesOnMaster
public void setGateVariable(AtomicBoolean gate)
public ServerName randomAssignment(HRegionInfo regionInfo, List<ServerName> servers)
BaseLoadBalancer
randomAssignment
in interface LoadBalancer
randomAssignment
in class BaseLoadBalancer
regionInfo
- Region for which this selection is being done.public Map<ServerName,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,ServerName> regions, List<ServerName> servers)
BaseLoadBalancer
Takes a map of all regions to their existing assignment from META. Also takes a list of online servers for regions to be assigned to. Attempts to retain all assignment, so in some instances initial assignment will not be completely balanced.
Any leftover regions without an existing server to be assigned to will be assigned randomly to available servers.
retainAssignment
in interface LoadBalancer
retainAssignment
in class BaseLoadBalancer
regions
- regions and existing assignment from metaservers
- available servers