You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2019/03/07 11:09:13 UTC
[hadoop] branch trunk updated: HADOOP-16114.
NetUtils#canonicalizeHost gives different value for same host.
This is an automated email from the ASF dual-hosted git repository.
stevel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2b94e51 HADOOP-16114. NetUtils#canonicalizeHost gives different value for same host.
2b94e51 is described below
commit 2b94e51a8f17548e5ef6af8e1e934a94031bb1dc
Author: Praveen Krishna <pr...@tutanota.com>
AuthorDate: Thu Mar 7 11:06:34 2019 +0000
HADOOP-16114. NetUtils#canonicalizeHost gives different value for same host.
Author: Praveen Krishna <pr...@tutanota.com>
---
.../hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
index bd2ff7b..0e9ea04 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java
@@ -288,8 +288,10 @@ public class NetUtils {
if (fqHost == null) {
try {
fqHost = SecurityUtil.getByName(host).getHostName();
- // slight race condition, but won't hurt
canonicalizedHostCache.putIfAbsent(host, fqHost);
+ // ensures that we won't return a canonicalized stale (non-cached)
+ // host name for a given host
+ fqHost = canonicalizedHostCache.get(host);
} catch (UnknownHostException e) {
fqHost = host;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org