HDFS-2890. DFSUtil#getSuffixIDs should skip unset configurations. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1240447 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-02-04 03:00:17 +00:00
parent 11df1c2561
commit 3cc71933e9
2 changed files with 10 additions and 2 deletions

View File

@ -162,3 +162,5 @@ marked required. (atm via eli)
HDFS-2863. Failures observed if dfs.edits.dir and shared.edits.dir have same directories. (Bikas Saha via atm) HDFS-2863. Failures observed if dfs.edits.dir and shared.edits.dir have same directories. (Bikas Saha via atm)
HDFS-2874. Edit log should log to shared dirs before local dirs. (todd) HDFS-2874. Edit log should log to shared dirs before local dirs. (todd)
HDFS-2890. DFSUtil#getSuffixIDs should skip unset configurations. (atm)

View File

@ -655,7 +655,6 @@ public class DFSUtil {
*/ */
public static String getInfoServer( public static String getInfoServer(
InetSocketAddress namenodeAddr, Configuration conf, boolean httpsAddress) { InetSocketAddress namenodeAddr, Configuration conf, boolean httpsAddress) {
String httpAddress = null;
boolean securityOn = UserGroupInformation.isSecurityEnabled(); boolean securityOn = UserGroupInformation.isSecurityEnabled();
String httpAddressKey = (securityOn && httpsAddress) ? String httpAddressKey = (securityOn && httpsAddress) ?
DFS_NAMENODE_HTTPS_ADDRESS_KEY : DFS_NAMENODE_HTTP_ADDRESS_KEY; DFS_NAMENODE_HTTPS_ADDRESS_KEY : DFS_NAMENODE_HTTP_ADDRESS_KEY;
@ -957,16 +956,23 @@ public class DFSUtil {
Collection<String> nnIds = getNameNodeIds(conf, nsId); Collection<String> nnIds = getNameNodeIds(conf, nsId);
for (String nnId : emptyAsSingletonNull(nnIds)) { for (String nnId : emptyAsSingletonNull(nnIds)) {
if (LOG.isTraceEnabled()) {
LOG.trace(String.format("addressKey: %s nsId: %s nnId: %s",
addressKey, nsId, nnId));
}
if (knownNNId != null && !knownNNId.equals(nnId)) { if (knownNNId != null && !knownNNId.equals(nnId)) {
continue; continue;
} }
String key = addKeySuffixes(addressKey, nsId, nnId); String key = addKeySuffixes(addressKey, nsId, nnId);
String addr = conf.get(key); String addr = conf.get(key);
if (addr == null) {
continue;
}
InetSocketAddress s = null; InetSocketAddress s = null;
try { try {
s = NetUtils.createSocketAddr(addr); s = NetUtils.createSocketAddr(addr);
} catch (Exception e) { } catch (Exception e) {
LOG.warn("Exception in creating socket address", e); LOG.warn("Exception in creating socket address " + addr, e);
continue; continue;
} }
if (!s.isUnresolved() && matcher.match(s)) { if (!s.isUnresolved() && matcher.match(s)) {