@InterfaceAudience.Private public class RegionPlacementMaintainer extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
RegionPlacementMaintainer.RandomizedMatrix
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.
|
Modifier and Type | Field and Description |
---|---|
private static float |
AVOID_COST |
private org.apache.hadoop.conf.Configuration |
conf |
private Connection |
connection |
private boolean |
enforceLocality |
private boolean |
enforceMinAssignmentMove |
private static float |
LAST_SLOT_COST_PENALTY |
private static org.slf4j.Logger |
LOG |
private static float |
MAX_COST |
private static float |
NOT_CURRENT_HOST_PENALTY |
private RackManager |
rackManager |
private Set<TableName> |
targetTableSet |
private static boolean |
USE_MUNKRES_FOR_PLACING_SECONDARY_AND_TERTIARY |
Constructor and Description |
---|
RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf) |
RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf,
boolean enforceLocality,
boolean enforceMinAssignmentMove) |
Modifier and Type | Method and Description |
---|---|
void |
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 locality
|
private void |
genAssignmentPlan(TableName tableName,
SnapshotOfRegionAssignmentFromMeta assignmentSnapshot,
Map<String,Map<String,Float>> regionLocalityMap,
FavoredNodesPlan plan,
boolean munkresForSecondaryAndTertiary)
Generate the assignment plan for the existing table nnnn * @param
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 n
|
static List<ServerName> |
getFavoredNodeList(String favoredNodesStr) |
FavoredNodesPlan |
getNewAssignmentPlan() |
SnapshotOfRegionAssignmentFromMeta |
getRegionAssignmentSnapshot()
Returns the new RegionAssignmentSnapshot n
|
Map<TableName,Integer> |
getRegionsMovement(FavoredNodesPlan newPlan)
Return how many regions will move per table since their primary RS will change
|
static void |
main(String[] args) |
static void |
printAssignmentPlan(FavoredNodesPlan plan)
Print the assignment plan to the system output stream n
|
void |
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 |
printLocalityAndDispersionForCurrentPlan(Map<String,Map<String,Float>> regionLocalityMap) |
void |
setTargetTableName(String[] tableNames) |
void |
updateAssignmentPlan(FavoredNodesPlan plan) |
void |
updateAssignmentPlanToMeta(FavoredNodesPlan plan)
Update the assignment plan into hbase:meta
|
private void |
updateAssignmentPlanToRegionServers(FavoredNodesPlan plan)
Update the assignment plan to all the region servers nn
|
List<AssignmentVerificationReport> |
verifyRegionPlacement(boolean isDetailMode)
Verify the region placement is consistent with the assignment plan nnn
|
private static final org.slf4j.Logger LOG
private static final float MAX_COST
private static final float AVOID_COST
private static final float LAST_SLOT_COST_PENALTY
private static final float NOT_CURRENT_HOST_PENALTY
private static boolean USE_MUNKRES_FOR_PLACING_SECONDARY_AND_TERTIARY
private org.apache.hadoop.conf.Configuration conf
private final boolean enforceLocality
private final boolean enforceMinAssignmentMove
private RackManager rackManager
private Set<TableName> targetTableSet
private final Connection connection
public RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf)
public RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf, boolean enforceLocality, boolean enforceMinAssignmentMove)
private static void printHelp(org.apache.hbase.thirdparty.org.apache.commons.cli.Options opt)
public void setTargetTableName(String[] tableNames)
public SnapshotOfRegionAssignmentFromMeta getRegionAssignmentSnapshot() throws IOException
IOException
public List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode) throws IOException
IOException
private void genAssignmentPlan(TableName tableName, SnapshotOfRegionAssignmentFromMeta assignmentSnapshot, Map<String,Map<String,Float>> regionLocalityMap, FavoredNodesPlan plan, boolean munkresForSecondaryAndTertiary) throws IOException
IOException
public FavoredNodesPlan getNewAssignmentPlan() throws IOException
IOException
public static void printAssignmentPlan(FavoredNodesPlan plan)
public void updateAssignmentPlanToMeta(FavoredNodesPlan plan) throws IOException
plan
- the assignments plan to be updated into hbase:metaIOException
- if cannot update assignment plan in hbase:metaprivate void updateAssignmentPlanToRegionServers(FavoredNodesPlan plan) throws IOException
IOException
public void updateAssignmentPlan(FavoredNodesPlan plan) throws IOException
IOException
public Map<TableName,Integer> getRegionsMovement(FavoredNodesPlan newPlan) throws IOException
newPlan
- - new AssignmentPlanIOException
public void checkDifferencesWithOldPlan(Map<TableName,Integer> movesPerTable, Map<String,Map<String,Float>> regionLocalityMap, FavoredNodesPlan newPlan) throws IOException
movesPerTable
- - how many primary regions will move per tableregionLocalityMap
- - locality map from FSnewPlan
- - new assignment plan nIOException
public void printDispersionScores(TableName table, SnapshotOfRegionAssignmentFromMeta snapshot, int numRegions, FavoredNodesPlan newPlan, boolean simplePrint)
public void printLocalityAndDispersionForCurrentPlan(Map<String,Map<String,Float>> regionLocalityMap) throws IOException
IOException
public static List<ServerName> getFavoredNodeList(String favoredNodesStr)
favoredNodesStr
- The String of favored nodespublic static void main(String[] args) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.