org.apache.hadoop.hbase.master.balancer
Class FavoredNodeAssignmentHelper

java.lang.Object
  extended by org.apache.hadoop.hbase.master.balancer.FavoredNodeAssignmentHelper

@InterfaceAudience.Private
public class FavoredNodeAssignmentHelper
extends Object

Helper class for FavoredNodeLoadBalancer that has all the intelligence for racks, meta scans, etc. Instantiated by the FavoredNodeLoadBalancer when needed (from within calls like FavoredNodeLoadBalancer.randomAssignment(HRegionInfo, List)).


Field Summary
static short FAVORED_NODES_NUM
           
static byte[] FAVOREDNODES_QUALIFIER
           
 
Constructor Summary
FavoredNodeAssignmentHelper(List<ServerName> servers, org.apache.hadoop.conf.Configuration conf)
           
FavoredNodeAssignmentHelper(List<ServerName> servers, RackManager rackManager)
           
 
Method Summary
static Map<HRegionInfo,ServerName> fullScan(CatalogTracker catalogTracker, Set<TableName> disabledTables, boolean excludeOfflinedSplitParents, FavoredNodeLoadBalancer balancer)
          Perform full scan of the meta table similar to MetaReader.fullScan(CatalogTracker, Set, boolean) except that this is aware of the favored nodes
static ServerName[] getFavoredNodesList(byte[] favoredNodes)
           
static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes, CatalogTracker catalogTracker)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAVOREDNODES_QUALIFIER

public static final byte[] FAVOREDNODES_QUALIFIER

FAVORED_NODES_NUM

public static final short FAVORED_NODES_NUM
See Also:
Constant Field Values
Constructor Detail

FavoredNodeAssignmentHelper

public FavoredNodeAssignmentHelper(List<ServerName> servers,
                                   org.apache.hadoop.conf.Configuration conf)

FavoredNodeAssignmentHelper

public FavoredNodeAssignmentHelper(List<ServerName> servers,
                                   RackManager rackManager)
Method Detail

fullScan

public static Map<HRegionInfo,ServerName> fullScan(CatalogTracker catalogTracker,
                                                   Set<TableName> disabledTables,
                                                   boolean excludeOfflinedSplitParents,
                                                   FavoredNodeLoadBalancer balancer)
                                            throws IOException
Perform full scan of the meta table similar to MetaReader.fullScan(CatalogTracker, Set, boolean) except that this is aware of the favored nodes

Parameters:
catalogTracker -
disabledTables -
excludeOfflinedSplitParents -
balancer - required because we need to let the balancer know about the current favored nodes from meta scan
Returns:
Returns a map of every region to it's currently assigned server, according to META. If the region does not have an assignment it will have a null value in the map.
Throws:
IOException

updateMetaWithFavoredNodesInfo

public static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes,
                                                  CatalogTracker catalogTracker)
                                           throws IOException
Throws:
IOException

getFavoredNodesList

public static ServerName[] getFavoredNodesList(byte[] favoredNodes)
                                        throws com.google.protobuf.InvalidProtocolBufferException
Parameters:
favoredNodes - The PB'ed bytes of favored nodes
Returns:
the array of ServerName for the byte array of favored nodes.
Throws:
com.google.protobuf.InvalidProtocolBufferException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.