public class BalancerTestBase extends Object
ServerName
to lists of HRegionInfo
and to check list of region plans.Modifier and Type | Class and Description |
---|---|
static class |
BalancerTestBase.MockMapping |
Constructor and Description |
---|
BalancerTestBase() |
Modifier and Type | Method and Description |
---|---|
void |
assertClusterAsBalanced(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers)
Invariant is that all servers have between floor(avg) and ceiling(avg)
number of regions.
|
void |
assertRegionReplicaPlacement(Map<ServerName,List<HRegionInfo>> serverMap,
RackManager rackManager)
Checks whether region replicas are not hosted on the same host.
|
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
convertToList(Map<ServerName,List<HRegionInfo>> servers) |
protected BaseLoadBalancer.Cluster |
mockCluster(int[] mockCluster) |
protected TreeMap<ServerName,List<HRegionInfo>> |
mockClusterServers(int[] mockCluster) |
protected TreeMap<ServerName,List<HRegionInfo>> |
mockClusterServers(int[] mockCluster,
int numTables) |
protected String |
printMock(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> balancedCluster) |
protected String |
printStats(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers) |
protected List<HRegionInfo> |
randomRegions(int numRegions) |
protected List<HRegionInfo> |
randomRegions(int numRegions,
int numTables) |
protected org.apache.hadoop.hbase.master.balancer.ServerAndLoad |
randomServer(int numRegionsPerServer) |
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
randomServers(int numServers,
int numRegionsPerServer) |
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
reconcile(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> list,
List<RegionPlan> plans,
Map<ServerName,List<HRegionInfo>> servers)
This assumes the RegionPlan HSI instances are the same ones in the map, so
actually no need to even pass in the map, but I think it's clearer.
|
protected void |
returnRegions(List<HRegionInfo> regions) |
protected void |
returnServer(ServerName server) |
protected void |
returnServers(List<ServerName> servers) |
protected void |
updateLoad(Map<ServerName,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> map,
ServerName sn,
int diff) |
protected static Random rand
public void assertClusterAsBalanced(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers)
public void assertRegionReplicaPlacement(Map<ServerName,List<HRegionInfo>> serverMap, RackManager rackManager)
protected String printStats(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers)
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> convertToList(Map<ServerName,List<HRegionInfo>> servers)
protected String printMock(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> balancedCluster)
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> reconcile(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> list, List<RegionPlan> plans, Map<ServerName,List<HRegionInfo>> servers)
list
- plans
- protected void updateLoad(Map<ServerName,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> map, ServerName sn, int diff)
protected TreeMap<ServerName,List<HRegionInfo>> mockClusterServers(int[] mockCluster)
protected BaseLoadBalancer.Cluster mockCluster(int[] mockCluster)
protected TreeMap<ServerName,List<HRegionInfo>> mockClusterServers(int[] mockCluster, int numTables)
protected List<HRegionInfo> randomRegions(int numRegions)
protected List<HRegionInfo> randomRegions(int numRegions, int numTables)
protected void returnRegions(List<HRegionInfo> regions)
protected org.apache.hadoop.hbase.master.balancer.ServerAndLoad randomServer(int numRegionsPerServer)
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> randomServers(int numServers, int numRegionsPerServer)
protected void returnServer(ServerName server)
protected void returnServers(List<ServerName> servers)