HDFS-9100. HDFS Balancer does not respect dfs.client.use.datanode.hostname. Contributed by Casey Brotherton.

(cherry picked from commit 1037ee580f)
This commit is contained in:
Yongjun Zhang 2015-10-02 11:56:55 -07:00
parent 4d01dbda50
commit 7964b13405
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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() {