public class BalancerTestBase extends Object
ServerName
to lists of RegionInfo
and to check list of region plans.Modifier and Type | Class and Description |
---|---|
static class |
BalancerTestBase.MockMapping |
Modifier and Type | Field and Description |
---|---|
protected int[][] |
clusterStateMocks |
protected int[][] |
clusterStateMocksWithNoSlop |
protected int[][] |
clusterStateMocksWithSlop |
protected static org.apache.hadoop.conf.Configuration |
conf |
protected static DummyMetricsStochasticBalancer |
dummyMetricsStochasticBalancer |
protected int[] |
largeCluster |
protected static org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer |
loadBalancer |
private static org.slf4j.Logger |
LOG |
(package private) static int |
regionId |
private Queue<org.apache.hadoop.hbase.client.RegionInfo> |
regionQueue |
private Queue<org.apache.hadoop.hbase.ServerName> |
serverQueue |
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.
|
boolean |
assertClusterOverallAsBalanced(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers,
int tablenum)
Invariant is that all servers have between acceptable range number of regions.
|
void |
assertRegionReplicaPlacement(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap,
org.apache.hadoop.hbase.master.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<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> servers) |
protected List<org.apache.hadoop.hbase.client.RegionInfo> |
createRegions(int numRegions,
org.apache.hadoop.hbase.TableName tableName) |
protected Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
createServerMap(int numNodes,
int numRegions,
int numRegionsPerServer,
int replication,
int numTables) |
protected org.apache.hadoop.hbase.master.balancer.BalancerClusterState |
mockCluster(int[] mockCluster) |
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
mockClusterServers(int[] mockCluster) |
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
mockClusterServers(int[][] mockCluster) |
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
mockClusterServers(int[] mockCluster,
int numTables) |
protected HashMap<org.apache.hadoop.hbase.TableName,TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>>> |
mockClusterServersWithTables(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> clusterServers) |
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
mockUniformClusterServers(int[] mockCluster) |
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<org.apache.hadoop.hbase.client.RegionInfo> |
randomRegions(int numRegions) |
protected List<org.apache.hadoop.hbase.client.RegionInfo> |
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<org.apache.hadoop.hbase.master.RegionPlan> plans,
Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> 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<org.apache.hadoop.hbase.client.RegionInfo> regions) |
protected void |
returnServer(org.apache.hadoop.hbase.ServerName server) |
protected void |
returnServers(List<org.apache.hadoop.hbase.ServerName> servers) |
protected void |
testWithCluster(int numNodes,
int numRegions,
int numRegionsPerServer,
int replication,
int numTables,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected void |
testWithCluster(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap,
org.apache.hadoop.hbase.master.RackManager rackManager,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected void |
testWithClusterWithIteration(int numNodes,
int numRegions,
int numRegionsPerServer,
int replication,
int numTables,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected void |
testWithClusterWithIteration(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap,
org.apache.hadoop.hbase.master.RackManager rackManager,
boolean assertFullyBalanced,
boolean assertFullyBalancedForReplicas) |
protected List<org.apache.hadoop.hbase.client.RegionInfo> |
uniformRegions(int numRegions) |
protected void |
updateLoad(Map<org.apache.hadoop.hbase.ServerName,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> map,
org.apache.hadoop.hbase.ServerName sn,
int diff) |
private static final org.slf4j.Logger LOG
static int regionId
protected static org.apache.hadoop.conf.Configuration conf
protected static org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer loadBalancer
protected static DummyMetricsStochasticBalancer dummyMetricsStochasticBalancer
protected int[] largeCluster
protected int[][] clusterStateMocks
protected int[][] clusterStateMocksWithNoSlop
protected int[][] clusterStateMocksWithSlop
private Queue<org.apache.hadoop.hbase.client.RegionInfo> regionQueue
private Queue<org.apache.hadoop.hbase.ServerName> serverQueue
public BalancerTestBase()
public static void beforeAllTests() throws Exception
Exception
public void assertClusterAsBalanced(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers)
public boolean assertClusterOverallAsBalanced(List<org.apache.hadoop.hbase.master.balancer.ServerAndLoad> servers, int tablenum)
public void assertRegionReplicaPlacement(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap, org.apache.hadoop.hbase.master.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<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> 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<org.apache.hadoop.hbase.master.RegionPlan> plans, Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> servers)
ServerAndLoad
values.protected void updateLoad(Map<org.apache.hadoop.hbase.ServerName,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> map, org.apache.hadoop.hbase.ServerName sn, int diff)
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockClusterServers(int[][] mockCluster)
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockClusterServers(int[] mockCluster)
protected org.apache.hadoop.hbase.master.balancer.BalancerClusterState mockCluster(int[] mockCluster)
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockClusterServers(int[] mockCluster, int numTables)
protected TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockUniformClusterServers(int[] mockCluster)
protected HashMap<org.apache.hadoop.hbase.TableName,TreeMap<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>>> mockClusterServersWithTables(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> clusterServers)
protected List<org.apache.hadoop.hbase.client.RegionInfo> randomRegions(int numRegions)
protected List<org.apache.hadoop.hbase.client.RegionInfo> createRegions(int numRegions, org.apache.hadoop.hbase.TableName tableName)
protected List<org.apache.hadoop.hbase.client.RegionInfo> randomRegions(int numRegions, int numTables)
protected List<org.apache.hadoop.hbase.client.RegionInfo> uniformRegions(int numRegions)
protected void returnRegions(List<org.apache.hadoop.hbase.client.RegionInfo> 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(org.apache.hadoop.hbase.ServerName server)
protected void returnServers(List<org.apache.hadoop.hbase.ServerName> servers)
protected void testWithCluster(int numNodes, int numRegions, int numRegionsPerServer, int replication, int numTables, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
protected void testWithClusterWithIteration(int numNodes, int numRegions, int numRegionsPerServer, int replication, int numTables, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
protected void testWithCluster(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap, org.apache.hadoop.hbase.master.RackManager rackManager, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
protected void testWithClusterWithIteration(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverMap, org.apache.hadoop.hbase.master.RackManager rackManager, boolean assertFullyBalanced, boolean assertFullyBalancedForReplicas)
protected Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> createServerMap(int numNodes, int numRegions, int numRegionsPerServer, int replication, int numTables)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.