Merge -r 1487092:1487093 from trunk onto branch-2. Fixes HDFS-4827.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1487099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
419fb4a4de
commit
0c221b3b03
|
@ -290,6 +290,9 @@ Release 2.0.5-beta - UNRELEASED
|
||||||
HDFS-4780. Use the correct relogin method for services. (Robert Parker via
|
HDFS-4780. Use the correct relogin method for services. (Robert Parker via
|
||||||
kihwal)
|
kihwal)
|
||||||
|
|
||||||
|
HDFS-4827. Slight update to the implementation of API for handling favored
|
||||||
|
nodes in DFSClient (ddas)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
|
BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
|
||||||
|
|
||||||
HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.
|
HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.
|
||||||
|
|
|
@ -1304,7 +1304,7 @@ public class DFSClient implements java.io.Closeable {
|
||||||
favoredNodeStrs = new String[favoredNodes.length];
|
favoredNodeStrs = new String[favoredNodes.length];
|
||||||
for (int i = 0; i < favoredNodes.length; i++) {
|
for (int i = 0; i < favoredNodes.length; i++) {
|
||||||
favoredNodeStrs[i] =
|
favoredNodeStrs[i] =
|
||||||
favoredNodes[i].getAddress().getHostAddress() + ":"
|
favoredNodes[i].getHostName() + ":"
|
||||||
+ favoredNodes[i].getPort();
|
+ favoredNodes[i].getPort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,20 +330,15 @@ public class DatanodeManager {
|
||||||
* @return the best match for the given datanode
|
* @return the best match for the given datanode
|
||||||
*/
|
*/
|
||||||
DatanodeDescriptor getDatanodeDescriptor(String address) {
|
DatanodeDescriptor getDatanodeDescriptor(String address) {
|
||||||
DatanodeDescriptor node = null;
|
DatanodeID dnId = parseDNFromHostsEntry(address);
|
||||||
int colon = address.indexOf(":");
|
String host = dnId.getIpAddr();
|
||||||
int xferPort;
|
int xferPort = dnId.getXferPort();
|
||||||
String host = address;
|
DatanodeDescriptor node = getDatanodeByXferAddr(host, xferPort);
|
||||||
if (colon > 0) {
|
|
||||||
host = address.substring(0, colon);
|
|
||||||
xferPort = Integer.parseInt(address.substring(colon+1));
|
|
||||||
node = getDatanodeByXferAddr(host, xferPort);
|
|
||||||
}
|
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
node = getDatanodeByHost(host);
|
node = getDatanodeByHost(host);
|
||||||
}
|
}
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
String networkLocation = resolveNetworkLocation(host);
|
String networkLocation = resolveNetworkLocation(dnId);
|
||||||
|
|
||||||
// If the current cluster doesn't contain the node, fallback to
|
// If the current cluster doesn't contain the node, fallback to
|
||||||
// something machine local and then rack local.
|
// something machine local and then rack local.
|
||||||
|
@ -505,11 +500,6 @@ public class DatanodeManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String resolveNetworkLocation(String host) {
|
|
||||||
DatanodeID d = parseDNFromHostsEntry(host);
|
|
||||||
return resolveNetworkLocation(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Resolve a node's network location */
|
/* Resolve a node's network location */
|
||||||
private String resolveNetworkLocation (DatanodeID node) {
|
private String resolveNetworkLocation (DatanodeID node) {
|
||||||
List<String> names = new ArrayList<String>(1);
|
List<String> names = new ArrayList<String>(1);
|
||||||
|
|
Loading…
Reference in New Issue