public class TestRegionPlacement extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.apache.hadoop.hbase.client.Admin |
admin |
static HBaseClassTestRule |
CLASS_RULE |
private static org.apache.hadoop.hbase.client.Connection |
CONNECTION |
private Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName[]> |
favoredNodesAssignmentPlan |
private int |
lastRegionOnPrimaryRSCount |
private static org.slf4j.Logger |
LOG |
private static org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position[] |
positions |
private int |
REGION_NUM |
private static org.apache.hadoop.hbase.master.RegionPlacementMaintainer |
rp |
private static int |
SLAVES |
private static HBaseTestingUtility |
TEST_UTIL |
| Constructor and Description |
|---|
TestRegionPlacement() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
createTable(org.apache.hadoop.hbase.TableName tableName,
int regionNum)
Create a table with specified table name and region number.
|
private int |
getNumRegionisOnPrimaryRS()
Check whether regions are assigned to servers consistent with the explicit
hints that are persisted in the hbase:meta table.
|
private void |
killRandomServerAndVerifyAssignment() |
static void |
setupBeforeClass() |
private org.apache.hadoop.hbase.favored.FavoredNodesPlan |
shuffleAssignmentPlan(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan,
org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position p1,
org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position p2)
Shuffle the assignment plan by switching two favored node positions.
|
static void |
tearDownAfterClass() |
void |
testRandomizedMatrix()
Used to test the correctness of this class.
|
void |
testRegionPlacement() |
private void |
verifyMETAUpdated(org.apache.hadoop.hbase.favored.FavoredNodesPlan expectedPlan)
Verify the meta has updated to the latest assignment plan
|
private void |
verifyRegionAssignment(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan,
int regionMovementNum,
int numRegionsOnPrimaryRS)
To verify the region assignment status.
|
private void |
verifyRegionMovementNum(int expected)
Verify the number of region movement is expected
|
private void |
verifyRegionOnPrimaryRS(int expectedNum)
Verify the number of user regions is assigned to the primary
region server based on the plan is expected
|
private void |
verifyRegionServerUpdated(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan)
Verify all the online region servers has been updated to the
latest assignment plan
|
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static final HBaseTestingUtility TEST_UTIL
private static final int SLAVES
private static org.apache.hadoop.hbase.client.Connection CONNECTION
private static org.apache.hadoop.hbase.client.Admin admin
private static org.apache.hadoop.hbase.master.RegionPlacementMaintainer rp
private static org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position[] positions
private int lastRegionOnPrimaryRSCount
private int REGION_NUM
private Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName[]> favoredNodesAssignmentPlan
public TestRegionPlacement()
public static void setupBeforeClass() throws Exception
Exceptionpublic static void tearDownAfterClass() throws Exception
Exceptionpublic void testRegionPlacement() throws Exception
Exceptionprivate void killRandomServerAndVerifyAssignment() throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
IOExceptionInterruptedExceptionorg.apache.zookeeper.KeeperExceptionpublic void testRandomizedMatrix()
private org.apache.hadoop.hbase.favored.FavoredNodesPlan shuffleAssignmentPlan(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan, org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position p1, org.apache.hadoop.hbase.favored.FavoredNodesPlan.Position p2) throws IOException
plan - The assignment planp1 - The first switch positionp2 - The second switch positionIOExceptionprivate void verifyRegionAssignment(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan, int regionMovementNum, int numRegionsOnPrimaryRS) throws InterruptedException, IOException
plan - regionMovementNum - numRegionsOnPrimaryRS - InterruptedExceptionIOExceptionprivate void verifyMETAUpdated(org.apache.hadoop.hbase.favored.FavoredNodesPlan expectedPlan) throws IOException
expectedPlan - the region assignment planIOException - if an IO problem is encounteredprivate void verifyRegionMovementNum(int expected) throws InterruptedException, IOException
InterruptedExceptionIOExceptionprivate void verifyRegionOnPrimaryRS(int expectedNum) throws IOException
expectedNum - the expected number of assigned regionsIOExceptionprivate void verifyRegionServerUpdated(org.apache.hadoop.hbase.favored.FavoredNodesPlan plan) throws IOException
plan - IOExceptionprivate int getNumRegionisOnPrimaryRS() throws IOException
IOExceptionprivate static void createTable(org.apache.hadoop.hbase.TableName tableName, int regionNum) throws IOException
tableName - the name of the table to be createdregionNum - number of regions to createIOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.