Package org.apache.hadoop.hbase.favored
Class FavoredNodesManager
java.lang.Object
org.apache.hadoop.hbase.favored.FavoredNodesManager
FavoredNodesManager is responsible for maintaining favored nodes info in internal cache and META
table. Its the centralized store for all favored nodes information. All reads and updates should
be done through this class. There should only be one instance of
FavoredNodesManager
in
Master. FavoredNodesPlan
and favored node information from
SnapshotOfRegionAssignmentFromMeta
should not be used outside this class (except for
tools that only read or fortest cases). All other classes including Favored balancers and
FavoredNodeAssignmentHelper
should use FavoredNodesManager
for any
read/write/deletes to favored nodes.-
Field Summary
Modifier and TypeFieldDescriptionprivate int
Datanode port to be used for Favored Nodes.private final FavoredNodesPlan
private final Map<ServerName,
List<RegionInfo>> private final ClusterInfoProvider
private final Map<ServerName,
List<RegionInfo>> private final Map<ServerName,
List<RegionInfo>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
addToReplicaLoad
(RegionInfo hri, List<ServerName> servers) void
deleteFavoredNodesForRegion
(RegionInfo regionInfo) void
deleteFavoredNodesForRegions
(Collection<RegionInfo> regionInfoList) static Set<RegionInfo>
filterNonFNApplicableRegions
(Collection<RegionInfo> regions) Filter and return regions for which favored nodes is not applicable.getFavoredNodes
(RegionInfo regionInfo) getFavoredNodesWithDNPort
(RegionInfo regionInfo) This should only be used when sending FN information to the region servers.getRegionsOfFavoredNode
(ServerName serverName) getReplicaLoad
(List<ServerName> servers) Get the replica count for the servers provided.void
static boolean
isFavoredNodeApplicable
(RegionInfo regionInfo) Favored nodes are not applicable for system tables.void
updateFavoredNodes
(Map<RegionInfo, List<ServerName>> regionFNMap)
-
Field Details
-
globalFavoredNodesAssignmentPlan
-
-
secondaryRSToRegionMap
-
teritiaryRSToRegionMap
-
provider
-
datanodeDataTransferPort
Datanode port to be used for Favored Nodes.
-
-
Constructor Details
-
FavoredNodesManager
-
-
Method Details
-
initializeFromMeta
- Throws:
IOException
-
getFavoredNodes
-
isFavoredNodeApplicable
Favored nodes are not applicable for system tables. We will use this to check before we apply any favored nodes logic on a region. -
filterNonFNApplicableRegions
Filter and return regions for which favored nodes is not applicable.- Returns:
- set of regions for which favored nodes is not applicable
-
getFavoredNodesWithDNPort
This should only be used when sending FN information to the region servers. Instead of sending the region server port, we use the datanode port. This helps in centralizing the DN port logic in Master. The RS uses the port from the favored node list as hints. -
updateFavoredNodes
- Throws:
IOException
-
addToReplicaLoad
-
getReplicaLoad
Get the replica count for the servers provided. For each server, replica count includes three counts for primary, secondary and tertiary. If a server is the primary favored node for 10 regions, secondary for 5 and tertiary for 1, then the list would be [10, 5, 1]. If the server is newly added to the cluster is not a favored node for any region, the replica count would be [0, 0, 0]. -
deleteFavoredNodesForRegion
-
deleteFavoredNodesForRegions
-
getRegionsOfFavoredNode
-