public class TestRSGroupBasedLoadBalancer extends Object
Modifier and Type | Field and Description |
---|---|
static HBaseClassTestRule |
CLASS_RULE |
(package private) static Map<String,org.apache.hadoop.hbase.rsgroup.RSGroupInfo> |
groupMap |
(package private) static String[] |
groups |
private static org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer |
loadBalancer |
private static org.slf4j.Logger |
LOG |
private static SecureRandom |
rand |
(package private) int[] |
regionAssignment |
(package private) static int |
regionId |
(package private) static List<org.apache.hadoop.hbase.ServerName> |
servers |
(package private) static org.apache.hadoop.hbase.TableName |
table0 |
(package private) static List<org.apache.hadoop.hbase.HTableDescriptor> |
tableDescs |
(package private) static Map<org.apache.hadoop.hbase.TableName,String> |
tableMap |
(package private) static org.apache.hadoop.hbase.TableName[] |
tables |
Constructor and Description |
---|
TestRSGroupBasedLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
private void |
assertClusterAsBalanced(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupLoadMap)
Invariant is that all servers of a group have load between floor(avg) and
ceiling(avg) number of regions.
|
private void |
assertImmediateAssignment(List<org.apache.hadoop.hbase.client.RegionInfo> regions,
List<org.apache.hadoop.hbase.ServerName> servers,
Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> assignments)
All regions have an assignment.
|
private void |
assertRetainedAssignment(Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> existing,
List<org.apache.hadoop.hbase.ServerName> servers,
Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> assignment)
Asserts a valid retained assignment plan.
|
private List<org.apache.hadoop.hbase.client.RegionInfo> |
assignedRegions(int numRegions,
org.apache.hadoop.hbase.ServerName sn)
Generate assigned regions to a given server using group information.
|
static void |
beforeAllTests() |
private static Map<String,org.apache.hadoop.hbase.rsgroup.RSGroupInfo> |
constructGroupInfo(List<org.apache.hadoop.hbase.ServerName> servers,
String[] groups)
Construct group info, with each group having at least one server.
|
private static List<org.apache.hadoop.hbase.HTableDescriptor> |
constructTableDesc()
Construct table descriptors evenly distributed between the groups.
|
private org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
convertToGroupBasedMap(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serversMap) |
private static List<org.apache.hadoop.hbase.ServerName> |
generateServers(int numServers) |
private static org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager |
getMockedGroupInfoManager() |
private static org.apache.hadoop.hbase.master.MasterServices |
getMockedMaster() |
private org.apache.hadoop.hbase.TableName |
getTableName(org.apache.hadoop.hbase.ServerName sn) |
private Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> |
mockClusterServers() |
private String |
printStats(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupBasedLoad) |
private List<org.apache.hadoop.hbase.client.RegionInfo> |
randomRegions(int numRegions)
Generate a list of regions evenly distributed between the tables.
|
private org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> |
reconcile(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad,
List<org.apache.hadoop.hbase.master.RegionPlan> plans) |
void |
testBalanceCluster()
Test the load balancing algorithm.
|
void |
testBulkAssignment()
Tests the bulk assignment used during cluster startup.
|
void |
testGetMisplacedRegions() |
void |
testRetainAssignment()
Test the cluster startup bulk assignment which attempts to retain assignment info.
|
void |
testRoundRobinAssignment()
Test BOGUS_SERVER_NAME among groups do not overwrite each other.
|
private void |
updateLoad(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad,
org.apache.hadoop.hbase.ServerName sn,
int diff) |
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static org.apache.hadoop.hbase.rsgroup.RSGroupBasedLoadBalancer loadBalancer
private static SecureRandom rand
static org.apache.hadoop.hbase.TableName table0
static org.apache.hadoop.hbase.TableName[] tables
static List<org.apache.hadoop.hbase.HTableDescriptor> tableDescs
int[] regionAssignment
static int regionId
public TestRSGroupBasedLoadBalancer()
public static void beforeAllTests() throws Exception
Exception
public void testBalanceCluster() throws Exception
Exception
private void assertClusterAsBalanced(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupLoadMap)
private void assertImmediateAssignment(List<org.apache.hadoop.hbase.client.RegionInfo> regions, List<org.apache.hadoop.hbase.ServerName> servers, Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> assignments) throws IOException
IOException
public void testBulkAssignment() throws Exception
Exception
public void testGetMisplacedRegions() throws Exception
Exception
public void testRetainAssignment() throws Exception
Exception
public void testRoundRobinAssignment() throws Exception
Exception
private void assertRetainedAssignment(Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> existing, List<org.apache.hadoop.hbase.ServerName> servers, Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> assignment) throws FileNotFoundException, IOException
Must meet the following conditions:
FileNotFoundException
IOException
private String printStats(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupBasedLoad)
private org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> convertToGroupBasedMap(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serversMap) throws IOException
IOException
private org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> reconcile(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad, List<org.apache.hadoop.hbase.master.RegionPlan> plans)
private void updateLoad(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad, org.apache.hadoop.hbase.ServerName sn, int diff)
private Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockClusterServers() throws IOException
IOException
private List<org.apache.hadoop.hbase.client.RegionInfo> randomRegions(int numRegions)
numRegions
- The number of regions to be generated.private List<org.apache.hadoop.hbase.client.RegionInfo> assignedRegions(int numRegions, org.apache.hadoop.hbase.ServerName sn) throws IOException
numRegions
- the num regions to generatesn
- the servernameIOException
- Signals that an I/O exception has occurred.private static List<org.apache.hadoop.hbase.ServerName> generateServers(int numServers)
private static Map<String,org.apache.hadoop.hbase.rsgroup.RSGroupInfo> constructGroupInfo(List<org.apache.hadoop.hbase.ServerName> servers, String[] groups)
servers
- the serversgroups
- the groupsprivate static List<org.apache.hadoop.hbase.HTableDescriptor> constructTableDesc()
private static org.apache.hadoop.hbase.master.MasterServices getMockedMaster() throws IOException
IOException
private static org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager getMockedGroupInfoManager() throws IOException
IOException
private org.apache.hadoop.hbase.TableName getTableName(org.apache.hadoop.hbase.ServerName sn) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.