diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5d7c009676..a5398891e3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -280,6 +280,8 @@ Release 0.23.2 - UNRELEASED dfs.client.block.write.replace-datanode-on-failure.enable should be true. (szetszwo) + HDFS-3008. Negative caching of local addrs doesn't work. (eli) + Release 0.23.1 - 2012-02-17 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index 2fae52a850..491cd7e989 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -542,17 +542,19 @@ static BlockReader getLocalBlockReader(Configuration conf, private static boolean isLocalAddress(InetSocketAddress targetAddr) { InetAddress addr = targetAddr.getAddress(); Boolean cached = localAddrMap.get(addr.getHostAddress()); - if (cached != null && cached) { + if (cached != null) { if (LOG.isTraceEnabled()) { - LOG.trace("Address " + targetAddr + " is local"); + LOG.trace("Address " + targetAddr + + (cached ? " is local" : " is not local")); } - return true; + return cached; } boolean local = NetUtils.isLocalAddress(addr); if (LOG.isTraceEnabled()) { - LOG.trace("Address " + targetAddr + " is local"); + LOG.trace("Address " + targetAddr + + (local ? " is local" : " is not local")); } localAddrMap.put(addr.getHostAddress(), local); return local;