@InterfaceAudience.Private public class FavoredNodeAssignmentHelper extends Object
FavoredNodeLoadBalancer that has all the intelligence for racks,
meta scans, etc. Instantiated by the FavoredNodeLoadBalancer when needed (from
within calls like FavoredNodeLoadBalancer.randomAssignment(RegionInfo, List)).
All updates to favored nodes should only be done from FavoredNodesManager and not
through this helper class (except for tests).| 限定符和类型 | 字段和说明 |
|---|---|
static short |
FAVORED_NODES_NUM |
static byte[] |
FAVOREDNODES_QUALIFIER |
static short |
MAX_ATTEMPTS_FN_GENERATION |
| 构造器和说明 |
|---|
FavoredNodeAssignmentHelper(List<ServerName> servers,
org.apache.hadoop.conf.Configuration conf) |
FavoredNodeAssignmentHelper(List<ServerName> servers,
RackManager rackManager) |
public static final byte[] FAVOREDNODES_QUALIFIER
public static final short FAVORED_NODES_NUM
public static final short MAX_ATTEMPTS_FN_GENERATION
public FavoredNodeAssignmentHelper(List<ServerName> servers, org.apache.hadoop.conf.Configuration conf)
public FavoredNodeAssignmentHelper(List<ServerName> servers, RackManager rackManager)
public void initialize()
public static void updateMetaWithFavoredNodesInfo(Map<RegionInfo,List<ServerName>> regionToFavoredNodes, Connection connection) throws IOException
regionToFavoredNodes - map of RegionInfo's to their favored nodesconnection - connection to be usedIOExceptionpublic static void updateMetaWithFavoredNodesInfo(Map<RegionInfo,List<ServerName>> regionToFavoredNodes, org.apache.hadoop.conf.Configuration conf) throws IOException
regionToFavoredNodes - conf - IOExceptionpublic static ServerName[] getFavoredNodesList(byte[] favoredNodes) throws IOException
favoredNodes - The PB'ed bytes of favored nodesServerName for the byte array of favored nodes.IOExceptionpublic static byte[] getFavoredNodes(List<ServerName> serverAddrList)
serverAddrList - HBaseProtos.FavoredNodes generated by the server list.public void placePrimaryRSAsRoundRobin(Map<ServerName,List<RegionInfo>> assignmentMap, Map<RegionInfo,ServerName> primaryRSMap, List<RegionInfo> regions)
public Map<RegionInfo,ServerName[]> placeSecondaryAndTertiaryRS(Map<RegionInfo,ServerName> primaryRSMap)
public ServerName[] getSecondaryAndTertiary(RegionInfo regionInfo, ServerName primaryRS) throws IOException
IOExceptionpublic Map<RegionInfo,ServerName[]> placeSecondaryAndTertiaryWithRestrictions(Map<RegionInfo,ServerName> primaryRSMap)
primaryRSMap - public boolean canPlaceFavoredNodes()
protected ServerName getOneRandomServer(String rack, Set<ServerName> skipServerSet)
rack - rack from a server is neededskipServerSet - the server shouldn't belong to this setprotected String getOneRandomRack(Set<String> skipRackSet) throws IOException
IOExceptionpublic static String getFavoredNodesAsString(List<ServerName> nodes)
public ServerName generateMissingFavoredNode(List<ServerName> favoredNodes) throws IOException
IOExceptionpublic ServerName generateMissingFavoredNode(List<ServerName> favoredNodes, List<ServerName> excludeNodes) throws IOException
IOExceptionpublic List<ServerName> generateFavoredNodes(RegionInfo hri) throws IOException
IOExceptionpublic Map<RegionInfo,List<ServerName>> generateFavoredNodesRoundRobin(Map<ServerName,List<RegionInfo>> assignmentMap, List<RegionInfo> regions) throws IOException
IOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.