Package org.apache.hadoop.hbase.master
Class RegionPlacementMaintainer
java.lang.Object
org.apache.hadoop.hbase.master.RegionPlacementMaintainer
A tool that is used for manipulating and viewing favored nodes information for regions. Run with
-h to get a list of the options
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Some algorithms for solving the assignment problem may traverse workers or jobs in linear order which may result in skewing the assignments of the first jobs in the matrix toward the last workers in the matrix if the costs are uniform. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final float
private org.apache.hadoop.conf.Configuration
private final Connection
private final boolean
private final boolean
private static final float
private static final org.slf4j.Logger
private static final float
private static final float
private RackManager
private static boolean
-
Constructor Summary
ConstructorDescriptionRegionPlacementMaintainer
(org.apache.hadoop.conf.Configuration conf) RegionPlacementMaintainer
(org.apache.hadoop.conf.Configuration conf, boolean enforceLocality, boolean enforceMinAssignmentMove) -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkDifferencesWithOldPlan
(Map<TableName, Integer> movesPerTable, Map<String, Map<String, Float>> regionLocalityMap, FavoredNodesPlan newPlan) Compares two plans and check whether the locality dropped or increased (prints the information as a string) also prints the baseline localityprivate void
genAssignmentPlan
(TableName tableName, SnapshotOfRegionAssignmentFromMeta assignmentSnapshot, Map<String, Map<String, Float>> regionLocalityMap, FavoredNodesPlan plan, boolean munkresForSecondaryAndTertiary) Generate the assignment plan for the existing tablestatic List<ServerName>
getFavoredNodeList
(String favoredNodesStr) Returns the new RegionAssignmentSnapshot ngetRegionsMovement
(FavoredNodesPlan newPlan) Return how many regions will move per table since their primary RS will changestatic void
static void
Print the assignment plan to the system output streamvoid
printDispersionScores
(TableName table, SnapshotOfRegionAssignmentFromMeta snapshot, int numRegions, FavoredNodesPlan newPlan, boolean simplePrint) private static void
printHelp
(org.apache.hbase.thirdparty.org.apache.commons.cli.Options opt) void
void
setTargetTableName
(String[] tableNames) void
void
Update the assignment plan into hbase:metaprivate void
Update the assignment plan to all the region serversverifyRegionPlacement
(boolean isDetailMode) Verify the region placement is consistent with the assignment plan
-
Field Details
-
LOG
-
MAX_COST
- See Also:
-
AVOID_COST
- See Also:
-
LAST_SLOT_COST_PENALTY
- See Also:
-
NOT_CURRENT_HOST_PENALTY
- See Also:
-
USE_MUNKRES_FOR_PLACING_SECONDARY_AND_TERTIARY
-
conf
-
enforceLocality
-
enforceMinAssignmentMove
-
rackManager
-
targetTableSet
-
connection
-
-
Constructor Details
-
RegionPlacementMaintainer
-
RegionPlacementMaintainer
public RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf, boolean enforceLocality, boolean enforceMinAssignmentMove)
-
-
Method Details
-
printHelp
-
setTargetTableName
-
getRegionAssignmentSnapshot
Returns the new RegionAssignmentSnapshot n- Throws:
IOException
-
verifyRegionPlacement
public List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode) throws IOException Verify the region placement is consistent with the assignment plan- Throws:
IOException
-
genAssignmentPlan
private void genAssignmentPlan(TableName tableName, SnapshotOfRegionAssignmentFromMeta assignmentSnapshot, Map<String, Map<String, throws IOExceptionFloat>> regionLocalityMap, FavoredNodesPlan plan, boolean munkresForSecondaryAndTertiary) Generate the assignment plan for the existing table- Parameters:
munkresForSecondaryAndTertiary
- if set on true the assignment plan for the tertiary and secondary will be generated with Munkres algorithm, otherwise will be generated using placeSecondaryAndTertiaryRS- Throws:
IOException
-
getNewAssignmentPlan
- Throws:
IOException
-
printAssignmentPlan
Print the assignment plan to the system output stream -
updateAssignmentPlanToMeta
Update the assignment plan into hbase:meta- Parameters:
plan
- the assignments plan to be updated into hbase:meta- Throws:
IOException
- if cannot update assignment plan in hbase:meta
-
updateAssignmentPlanToRegionServers
Update the assignment plan to all the region servers- Throws:
IOException
-
updateAssignmentPlan
- Throws:
IOException
-
getRegionsMovement
Return how many regions will move per table since their primary RS will change- Parameters:
newPlan
- - new AssignmentPlan- Returns:
- how many primaries will move per table
- Throws:
IOException
-
checkDifferencesWithOldPlan
public void checkDifferencesWithOldPlan(Map<TableName, Integer> movesPerTable, Map<String, throws IOExceptionMap<String, Float>> regionLocalityMap, FavoredNodesPlan newPlan) Compares two plans and check whether the locality dropped or increased (prints the information as a string) also prints the baseline locality- Parameters:
movesPerTable
- - how many primary regions will move per tableregionLocalityMap
- - locality map from FSnewPlan
- - new assignment plan- Throws:
IOException
-
printDispersionScores
public void printDispersionScores(TableName table, SnapshotOfRegionAssignmentFromMeta snapshot, int numRegions, FavoredNodesPlan newPlan, boolean simplePrint) -
printLocalityAndDispersionForCurrentPlan
public void printLocalityAndDispersionForCurrentPlan(Map<String, Map<String, throws IOExceptionFloat>> regionLocalityMap) - Throws:
IOException
-
getFavoredNodeList
- Parameters:
favoredNodesStr
- The String of favored nodes- Returns:
- the list of ServerName for the byte array of favored nodes.
-
main
- Throws:
IOException
-