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 |
Modifier and Type | Field and Description |
---|---|
protected static Configuration |
conf |
protected static StochasticLoadBalancer |
loadBalancer |
protected static Random |
rand |
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.
|
static void |
beforeAllTests() |
protected List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
convertToList(Map<ServerName,List<HRegionInfo>> servers) |
protected Map<ServerName,List<HRegionInfo>> |
createServerMap(int numNodes,
int numRegions,
int numRegionsPerServer,
int replication,
int numTables) |
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 |
testWithCluster(int numNodes,
int numRegions,
int numRegionsPerServer,
int replication,
int numTables,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected void |
testWithCluster(Map<ServerName,List<HRegionInfo>> serverMap,
RackManager rackManager,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected void |
updateLoad(Map<ServerName,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> map,
ServerName sn,
int diff) |
protected static Random rand
protected static StochasticLoadBalancer loadBalancer
protected static Configuration conf
protected void testWithCluster(int numNodes, int numRegions, int numRegionsPerServer, int replication, int numTables, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
protected Map<ServerName,List<HRegionInfo>> createServerMap(int numNodes, int numRegions, int numRegionsPerServer, int replication, int numTables)
protected void testWithCluster(Map<ServerName,List<HRegionInfo>> serverMap, RackManager rackManager, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
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)