@LimitedPrivate({"HDFS","MapReduce"})
@Unstable
public class NetworkTopologyWithNodeGroup
extends NetworkTopology
NetworkTopologyNetworkTopology.InvalidTopologyException| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
DEFAULT_NODEGROUP |
DEFAULT_RACK, LOG, netlock, numOfRacks| Constructor | Description |
|---|---|
NetworkTopologyWithNodeGroup() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(Node node) |
Add a leaf node
Update node counter & rack counter if necessary
|
protected Node |
getNodeForNetworkLocation(Node node) |
Return a reference to the node given its string representation.
|
java.lang.String |
getNodeGroup(java.lang.String loc) |
Given a string representation of a node group for a specific network
location
|
java.lang.String |
getRack(java.lang.String loc) |
Given a string representation of a rack for a specific network
location
To be overridden in subclasses for specific NetworkTopology
implementations, as alternative to overriding the full
NetworkTopology.getRack(String) method. |
protected int |
getWeight(Node reader,
Node node) |
Returns an integer weight which specifies how far away {node} is away from
{reader}.
|
boolean |
isNodeGroupAware() |
Check if network topology is aware of NodeGroup
|
boolean |
isOnSameNodeGroup(Node node1,
Node node2) |
Check if two nodes are on the same node group (hypervisor) The
assumption here is: each nodes are leaf nodes.
|
boolean |
isOnSameRack(Node node1,
Node node2) |
Check if two nodes are on the same rack
|
void |
remove(Node node) |
Remove a node
Update node counter and rack counter if necessary
|
void |
sortByDistance(Node reader,
Node[] nodes,
int activeLen) |
Sort nodes array by their distances to reader.
|
chooseRandom, chooseRandom, chooseRandom, contains, countNumOfAvailableNodes, decommissionNode, getDatanodesInRack, getDistance, getDistanceByPath, getFirstHalf, getInstance, getInstance, getLastHalf, getLeaves, getNode, getNumOfLeaves, getNumOfNonEmptyRacks, getNumOfRacks, getWeightUsingNetworkLocation, hasClusterEverBeenMultiRack, incrementRacks, init, isChildScope, isNodeInScope, isSameParents, recommissionNode, sortByDistance, sortByDistanceUsingNetworkLocation, sortByDistanceUsingNetworkLocation, toStringpublic static final java.lang.String DEFAULT_NODEGROUP
protected Node getNodeForNetworkLocation(Node node)
NetworkTopologyNetworkTopology.getNode(String).
To be overridden in subclasses for specific NetworkTopology
implementations, as alternative to overriding the full NetworkTopology.add(Node)
method.
getNodeForNetworkLocation in class NetworkTopologynode - The string representation of this node's network location is
used to retrieve a Node object.NetworkTopology.add(Node),
NetworkTopology.getNode(String)public java.lang.String getRack(java.lang.String loc)
NetworkTopologyNetworkTopology.getRack(String) method.getRack in class NetworkTopologyloc - a path-like string representation of a network locationpublic java.lang.String getNodeGroup(java.lang.String loc)
loc - a path-like string representation of a network locationpublic boolean isOnSameRack(Node node1, Node node2)
NetworkTopologyisOnSameRack in class NetworkTopologynode1 - one node (can be null)node2 - another node (can be null)public boolean isOnSameNodeGroup(Node node1, Node node2)
isOnSameNodeGroup in class NetworkTopologynode1 - one node (can be null)node2 - another node (can be null)java.lang.IllegalArgumentException - when either node1 or node2 is null, or node1 or node2 do
not belong to the clusterpublic boolean isNodeGroupAware()
isNodeGroupAware in class NetworkTopologypublic void add(Node node)
add in class NetworkTopologynode - node to be added; can be nulljava.lang.IllegalArgumentException - if add a node to a leave
or node to be added is not a leafpublic void remove(Node node)
remove in class NetworkTopologynode - node to be removed; can be nullprotected int getWeight(Node reader, Node node)
NetworkTopologygetWeight in class NetworkTopologyreader - Node where data will be readnode - Replica of datapublic void sortByDistance(Node reader, Node[] nodes, int activeLen)
This is the same as NetworkTopology.sortByDistance(Node, Node[],
int) except with a four-level network topology which contains the
additional network distance of a "node group" which is between local and
same rack.
sortByDistance in class NetworkTopologyreader - Node where data will be readnodes - Available replicas with the requested dataactiveLen - Number of active nodes at the front of the arrayCopyright © 2008–2025 Apache Software Foundation. All rights reserved.