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 byte[] getFavoredNodes(List<ServerName> serverAddrList)
           
static String getFavoredNodesAsString(List<ServerName> nodes)
           
static ServerName[] getFavoredNodesList(byte[] favoredNodes)
           
 void initialize()
           
 Map<HRegionInfo,ServerName[]> placeSecondaryAndTertiaryWithRestrictions(Map<HRegionInfo,ServerName> primaryRSMap)
          For regions that share the primary, avoid placing the secondary and tertiary on a same RS.
static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes, CatalogTracker catalogTracker)
          Update meta table with favored nodes info
static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes, org.apache.hadoop.conf.Configuration conf)
          Update meta table with favored nodes info
 
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

updateMetaWithFavoredNodesInfo

public static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes,
                                                  CatalogTracker catalogTracker)
                                           throws IOException
Update meta table with favored nodes info

Parameters:
regionToFavoredNodes -
catalogTracker -
Throws:
IOException

updateMetaWithFavoredNodesInfo

public static void updateMetaWithFavoredNodesInfo(Map<HRegionInfo,List<ServerName>> regionToFavoredNodes,
                                                  org.apache.hadoop.conf.Configuration conf)
                                           throws IOException
Update meta table with favored nodes info

Parameters:
regionToFavoredNodes -
conf -
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

getFavoredNodes

public static byte[] getFavoredNodes(List<ServerName> serverAddrList)
Parameters:
serverAddrList -
Returns:
PB'ed bytes of HBaseProtos.FavoredNodes generated by the server list.

placeSecondaryAndTertiaryWithRestrictions

public Map<HRegionInfo,ServerName[]> placeSecondaryAndTertiaryWithRestrictions(Map<HRegionInfo,ServerName> primaryRSMap)
For regions that share the primary, avoid placing the secondary and tertiary on a same RS. Used for generating new assignments for the primary/secondary/tertiary RegionServers

Parameters:
primaryRSMap -
Returns:
the map of regions to the servers the region-files should be hosted on
Throws:
IOException

initialize

public void initialize()

getFavoredNodesAsString

public static String getFavoredNodesAsString(List<ServerName> nodes)


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