hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject [18/50] [abbrv] hadoop git commit: HDFS-4210. Throw helpful exception when DNS entry for JournalNode cannot be resolved. Contributed by Charles Lamb and John Zhuge.
Date Tue, 06 Sep 2016 16:43:51 GMT
HDFS-4210. Throw helpful exception when DNS entry for JournalNode cannot be resolved. Contributed
by Charles Lamb and John Zhuge.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cd5e10cc
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cd5e10cc
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cd5e10cc

Branch: refs/heads/HADOOP-13345
Commit: cd5e10ccca9b919d55ef7a500e61b44bd1a00171
Parents: 05ede00
Author: Xiao Chen <xiao@apache.org>
Authored: Mon Aug 29 17:41:01 2016 -0700
Committer: Xiao Chen <xiao@apache.org>
Committed: Mon Aug 29 17:48:08 2016 -0700

----------------------------------------------------------------------
 .../qjournal/client/QuorumJournalManager.java    |  9 +++++++--
 .../hdfs/qjournal/client/TestQJMWithFaults.java  | 19 ++++++++++++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd5e10cc/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
index c32b667..ae3358b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/QuorumJournalManager.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URL;
+import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -387,8 +388,12 @@ public class QuorumJournalManager implements JournalManager {
     
     List<InetSocketAddress> addrs = Lists.newArrayList();
     for (String addr : parts) {
-      addrs.add(NetUtils.createSocketAddr(
-          addr, DFSConfigKeys.DFS_JOURNALNODE_RPC_PORT_DEFAULT));
+      InetSocketAddress isa = NetUtils.createSocketAddr(
+          addr, DFSConfigKeys.DFS_JOURNALNODE_RPC_PORT_DEFAULT);
+      if (isa.isUnresolved()) {
+        throw new UnknownHostException(addr);
+      }
+      addrs.add(isa);
     }
     return addrs;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd5e10cc/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
index b0a9b99..ecdbaf5 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestQJMWithFaults.java
@@ -27,7 +27,9 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.InetSocketAddress;
+import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.UnknownHostException;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -52,7 +54,9 @@ import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
 import org.apache.hadoop.test.GenericTestUtils;
 import org.apache.log4j.Level;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -125,7 +129,10 @@ public class TestQJMWithFaults {
     }
     return ret;
   }
-  
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
   /**
    * Sets up two of the nodes to each drop a single RPC, at all
    * possible combinations of RPCs. This may result in the
@@ -187,6 +194,16 @@ public class TestQJMWithFaults {
   }
   
   /**
+   * Expect {@link UnknownHostException} if a hostname can't be resolved.
+   */
+  @Test
+  public void testUnresolvableHostName() throws Exception {
+    expectedException.expect(UnknownHostException.class);
+    new QuorumJournalManager(conf,
+        new URI("qjournal://" + "bogus:12345" + "/" + JID), FAKE_NSINFO);
+  }
+
+  /**
    * Test case in which three JournalNodes randomly flip flop between
    * up and down states every time they get an RPC.
    * 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message