org.apache.hadoop.hbase.master
Class RegionPlacementMaintainer

java.lang.Object
  extended by org.apache.hadoop.hbase.master.RegionPlacementMaintainer

@InterfaceAudience.Private
public class RegionPlacementMaintainer
extends Object

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
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.
 
Constructor Summary
RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf)
           
RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf, boolean enforceLocality, boolean enforceMinAssignmentMove)
           
 
Method Summary
 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
static List<ServerName> getFavoredNodeList(String favoredNodesStr)
           
 FavoredNodesPlan getNewAssignmentPlan()
           
 SnapshotOfRegionAssignmentFromMeta getRegionAssignmentSnapshot()
           
 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
 void printDispersionScores(TableName table, SnapshotOfRegionAssignmentFromMeta snapshot, int numRegions, FavoredNodesPlan newPlan, boolean simplePrint)
           
 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
 List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode)
          Verify the region placement is consistent with the assignment plan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegionPlacementMaintainer

public RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf)

RegionPlacementMaintainer

public RegionPlacementMaintainer(org.apache.hadoop.conf.Configuration conf,
                                 boolean enforceLocality,
                                 boolean enforceMinAssignmentMove)
Method Detail

setTargetTableName

public void setTargetTableName(String[] tableNames)

getRegionAssignmentSnapshot

public SnapshotOfRegionAssignmentFromMeta getRegionAssignmentSnapshot()
                                                               throws IOException
Returns:
the new RegionAssignmentSnapshot
Throws:
IOException

verifyRegionPlacement

public List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode)
                                                         throws IOException
Verify the region placement is consistent with the assignment plan

Parameters:
isDetailMode -
Returns:
reports
Throws:
IOException

getNewAssignmentPlan

public FavoredNodesPlan getNewAssignmentPlan()
                                      throws IOException
Throws:
IOException

printAssignmentPlan

public static void printAssignmentPlan(FavoredNodesPlan plan)
Print the assignment plan to the system output stream

Parameters:
plan -

updateAssignmentPlanToMeta

public void updateAssignmentPlanToMeta(FavoredNodesPlan plan)
                                throws IOException
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

updateAssignmentPlan

public void updateAssignmentPlan(FavoredNodesPlan plan)
                          throws IOException
Throws:
IOException

getRegionsMovement

public Map<TableName,Integer> getRegionsMovement(FavoredNodesPlan newPlan)
                                          throws IOException
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,Map<String,Float>> regionLocalityMap,
                                        FavoredNodesPlan newPlan)
                                 throws IOException
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 table
regionLocalityMap - - locality map from FS
newPlan - - 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,Float>> regionLocalityMap)
                                              throws IOException
Throws:
IOException

getFavoredNodeList

public static List<ServerName> getFavoredNodeList(String favoredNodesStr)
Parameters:
favoredNodesStr - The String of favored nodes
Returns:
the list of ServerName for the byte array of favored nodes.

main

public static void main(String[] args)
                 throws IOException
Throws:
IOException


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.