@InterfaceAudience.Private public class FavoredNodeAssignmentHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static short |
FAVORED_NODES_NUM |
static byte[] |
FAVOREDNODES_QUALIFIER |
static short |
MAX_ATTEMPTS_FN_GENERATION |
| Constructor and Description |
|---|
FavoredNodeAssignmentHelper(List<ServerName> servers,
org.apache.hadoop.conf.Configuration conf) |
FavoredNodeAssignmentHelper(List<ServerName> servers,
RackManager rackManager) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canPlaceFavoredNodes() |
List<ServerName> |
generateFavoredNodes(RegionInfo hri) |
Map<RegionInfo,List<ServerName>> |
generateFavoredNodesRoundRobin(Map<ServerName,List<RegionInfo>> assignmentMap,
List<RegionInfo> regions) |
ServerName |
generateMissingFavoredNode(List<ServerName> favoredNodes) |
ServerName |
generateMissingFavoredNode(List<ServerName> favoredNodes,
List<ServerName> excludeNodes) |
static int |
getDataNodePort(org.apache.hadoop.conf.Configuration conf) |
static byte[] |
getFavoredNodes(List<ServerName> serverAddrList)
Returns PB'ed bytes of
HBaseProtos.FavoredNodes generated by the server list. |
static String |
getFavoredNodesAsString(List<ServerName> nodes) |
static ServerName[] |
getFavoredNodesList(byte[] favoredNodes)
Convert PB bytes to ServerName.
|
protected ServerName |
getOneRandomServer(String rack,
Set<ServerName> skipServerSet)
Gets a random server from the specified rack and skips anything specified.
|
ServerName[] |
getSecondaryAndTertiary(RegionInfo regionInfo,
ServerName primaryRS) |
void |
initialize() |
void |
placePrimaryRSAsRoundRobin(Map<ServerName,List<RegionInfo>> assignmentMap,
Map<RegionInfo,ServerName> primaryRSMap,
List<RegionInfo> regions) |
Map<RegionInfo,ServerName[]> |
placeSecondaryAndTertiaryRS(Map<RegionInfo,ServerName> primaryRSMap) |
Map<RegionInfo,ServerName[]> |
placeSecondaryAndTertiaryWithRestrictions(Map<RegionInfo,ServerName> primaryRSMap)
For regions that share the primary, avoid placing the secondary and tertiary on a same RS.
|
static void |
updateMetaWithFavoredNodesInfo(Map<RegionInfo,List<ServerName>> regionToFavoredNodes,
org.apache.hadoop.conf.Configuration conf)
Update meta table with favored nodes info
|
static void |
updateMetaWithFavoredNodesInfo(Map<RegionInfo,List<ServerName>> regionToFavoredNodes,
Connection connection)
Update meta table with favored nodes info
|
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
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)
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)
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 setpublic 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
IOExceptionpublic static int getDataNodePort(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.