Repository: hadoop Updated Branches: refs/heads/branch-2 4d01dbda5 -> 7964b1340
HDFS-9100. HDFS Balancer does not respect dfs.client.use.datanode.hostname. Contributed by Casey Brotherton. (cherry picked from commit 1037ee580f87e6bf13155834c36f26794381678b) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7964b134 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7964b134 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7964b134 Branch: refs/heads/branch-2 Commit: 7964b13405f6c5e7f680b9ec6d40be90b9019fcf Parents: 4d01dbd Author: Yongjun Zhang <[email protected]> Authored: Fri Oct 2 11:56:55 2015 -0700 Committer: Yongjun Zhang <[email protected]> Committed: Fri Oct 2 12:08:55 2015 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../apache/hadoop/hdfs/server/balancer/Dispatcher.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7964b134/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5eb9247..12a1c30 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1134,6 +1134,9 @@ Release 2.8.0 - UNRELEASED HDFS-9001. DFSUtil.getNsServiceRpcUris() can return too many entries in a non-HA, non-federated cluster. (Daniel Templeton via atm) + HDFS-9100. HDFS Balancer does not respect dfs.client.use.datanode.hostname. + (Casey Brotherton via Yongjun Zhang) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/7964b134/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java index 1afe0af..509b652 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java @@ -51,6 +51,7 @@ import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.DFSUtilClient; import org.apache.hadoop.hdfs.DistributedFileSystem; +import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; @@ -122,6 +123,8 @@ public class Dispatcher { private final int ioFileBufferSize; + private final boolean connectToDnViaHostname; + static class Allocator { private final int max; private int count = 0; @@ -318,8 +321,9 @@ public class Dispatcher { DataInputStream in = null; try { sock.connect( - NetUtils.createSocketAddr(target.getDatanodeInfo().getXferAddr()), - HdfsConstants.READ_TIMEOUT); + NetUtils.createSocketAddr(target.getDatanodeInfo(). + getXferAddr(Dispatcher.this.connectToDnViaHostname)), + HdfsConstants.READ_TIMEOUT); sock.setKeepAlive(true); @@ -881,6 +885,9 @@ public class Dispatcher { DataTransferSaslUtil.getSaslPropertiesResolver(conf), TrustedChannelResolver.getInstance(conf), nnc.fallbackToSimpleAuth); this.ioFileBufferSize = DFSUtilClient.getIoFileBufferSize(conf); + this.connectToDnViaHostname = conf.getBoolean( + HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME, + HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME_DEFAULT); } public DistributedFileSystem getDistributedFileSystem() {
