/** * Sort nodes array by their distances to <i>reader</i>. * <p/> * This is the same as {@link 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. * * @param reader Node where data will be read * @param nodes Available replicas with the requested data * @param activeLen Number of active nodes at the front of the array */ @Override public void sortByDistance(Node reader, Node[] nodes, int activeLen) { // If reader is not a datanode (not in NetworkTopology tree), we need to // replace this reader with a sibling leaf node in tree. if (reader != null && !this.contains(reader)) { Node nodeGroup = getNode(reader.getNetworkLocation()); if (nodeGroup != null && nodeGroup instanceof InnerNode) { InnerNode parentNode = (InnerNode) nodeGroup; // replace reader with the first children of its parent in tree reader = parentNode.getLeaf(0, null); } else { return; } } super.sortByDistance(reader, nodes, activeLen); }
/** * Sort nodes array by their distances to <i>reader</i>. * <p/> * This is the same as {@link 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. * * @param reader Node where data will be read * @param nodes Available replicas with the requested data * @param activeLen Number of active nodes at the front of the array */ @Override public void sortByDistance(Node reader, Node[] nodes, int activeLen) { // If reader is not a datanode (not in NetworkTopology tree), we need to // replace this reader with a sibling leaf node in tree. if (reader != null && !this.contains(reader)) { Node nodeGroup = getNode(reader.getNetworkLocation()); if (nodeGroup != null && nodeGroup instanceof InnerNode) { InnerNode parentNode = (InnerNode) nodeGroup; // replace reader with the first children of its parent in tree reader = parentNode.getLeaf(0, null); } else { return; } } super.sortByDistance(reader, nodes, activeLen); }
/** * Sort nodes array by their distances to <i>reader</i>. * <p/> * This is the same as {@link 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. * * @param reader Node where data will be read * @param nodes Available replicas with the requested data * @param activeLen Number of active nodes at the front of the array */ @Override public void sortByDistance(Node reader, Node[] nodes, int activeLen) { // If reader is not a datanode (not in NetworkTopology tree), we need to // replace this reader with a sibling leaf node in tree. if (reader != null && !this.contains(reader)) { Node nodeGroup = getNode(reader.getNetworkLocation()); if (nodeGroup != null && nodeGroup instanceof InnerNode) { InnerNode parentNode = (InnerNode) nodeGroup; // replace reader with the first children of its parent in tree reader = parentNode.getLeaf(0, null); } else { return; } } super.sortByDistance(reader, nodes, activeLen); }
/** * Sort nodes array by their distances to <i>reader</i>. * <p/> * This is the same as {@link 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. * * @param reader Node where data will be read * @param nodes Available replicas with the requested data * @param activeLen Number of active nodes at the front of the array */ @Override public void sortByDistance(Node reader, Node[] nodes, int activeLen) { // If reader is not a datanode (not in NetworkTopology tree), we need to // replace this reader with a sibling leaf node in tree. if (reader != null && !this.contains(reader)) { Node nodeGroup = getNode(reader.getNetworkLocation()); if (nodeGroup != null && nodeGroup instanceof InnerNode) { InnerNode parentNode = (InnerNode) nodeGroup; // replace reader with the first children of its parent in tree reader = parentNode.getLeaf(0, null); } else { return; } } super.sortByDistance(reader, nodes, activeLen); }
public void pseudoSortByDistance( Node reader, Node[] nodes ) { if (reader != null && !this.contains(reader)) {