hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject hadoop git commit: MAPREDUCE-6240. Hadoop client displays confusing error message. (gera)
Date Wed, 08 Jun 2016 20:25:39 GMT
Repository: hadoop
Updated Branches:
  refs/heads/MAPREDUCE-6240-trunk [created] 0af96a1c0


MAPREDUCE-6240. Hadoop client displays confusing error message. (gera)


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

Branch: refs/heads/MAPREDUCE-6240-trunk
Commit: 0af96a1c08594c809ecb254cee4f60dd22399772
Parents: 1ee9ea0
Author: Gera Shegalov <gera@apache.org>
Authored: Sat May 28 22:01:07 2016 -0700
Committer: Gera Shegalov <gera@apache.org>
Committed: Wed Jun 8 12:59:37 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/mapreduce/Cluster.java    | 15 ++++++-----
 .../TestClientProtocolProviderImpls.java        | 26 +++++++++++++++++---
 2 files changed, 32 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0af96a1c/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
index 9563c0b..6ca918d 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Cluster.java
@@ -102,6 +102,10 @@ public class Cluster {
       throws IOException {
 
     initProviderList();
+    final IOException initEx = new IOException(
+        "Cannot initialize Cluster. Please check your configuration for "
+            + MRConfig.FRAMEWORK_NAME
+            + " and the correspond server addresses.");
     for (ClientProtocolProvider provider : providerList) {
       LOG.debug("Trying ClientProtocolProvider : "
           + provider.getClass().getName());
@@ -124,16 +128,15 @@ public class Cluster {
               + " as the ClientProtocolProvider - returned null protocol");
         }
       } catch (Exception e) {
-        LOG.info("Failed to use " + provider.getClass().getName()
-            + " due to error: ", e);
+        final String errMsg = "Failed to use " + provider.getClass().getName()
+            + " due to error: ";
+        initEx.addSuppressed(new IOException(errMsg, e));
+        LOG.info(errMsg, e);
       }
     }
 
     if (null == clientProtocolProvider || null == client) {
-      throw new IOException(
-          "Cannot initialize Cluster. Please check your configuration for "
-              + MRConfig.FRAMEWORK_NAME
-              + " and the correspond server addresses.");
+      throw initEx;
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0af96a1c/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestClientProtocolProviderImpls.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestClientProtocolProviderImpls.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestClientProtocolProviderImpls.java
index 6ad76e9..500e133 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestClientProtocolProviderImpls.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/TestClientProtocolProviderImpls.java
@@ -18,17 +18,20 @@
 
 package org.apache.hadoop.mapreduce;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.io.IOException;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.UnsupportedFileSystemException;
 import org.apache.hadoop.mapred.LocalJobRunner;
 import org.apache.hadoop.mapred.YARNRunner;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
+import org.apache.hadoop.util.StringUtils;
 import org.junit.Test;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 public class TestClientProtocolProviderImpls {
 
   @Test
@@ -76,4 +79,21 @@ public class TestClientProtocolProviderImpls {
           "Cannot initialize Cluster. Please check"));
     }
   }
+
+  @Test
+  public void testClusterExceptionRootCause() throws Exception {
+    final Configuration conf = new Configuration();
+    conf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
+    conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "nosuchfs:///");
+    conf.set(JTConfig.JT_IPC_ADDRESS, "local");
+    try {
+      new Cluster(conf);
+      fail("Cluster init should fail because of non-existing FileSystem");
+    } catch (IOException ioEx) {
+      final String stackTrace = StringUtils.stringifyException(ioEx);
+      assertTrue("No root cause detected",
+          stackTrace.contains(UnsupportedFileSystemException.class.getName())
+              && stackTrace.contains("nosuchfs"));
+    }
+  }
 }


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