hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [04/50] [abbrv] hadoop git commit: HDFS-9112. Improve error message for Haadmin when multiple name service IDs are configured. Contributed by Anu Engineer.
Date Tue, 29 Sep 2015 20:30:06 GMT
HDFS-9112. Improve error message for Haadmin when multiple name service IDs are configured.
Contributed by Anu Engineer.


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

Branch: refs/heads/HDFS-7240
Commit: 83e99d06d0e5a71888aab33e9ae47460e9f1231f
Parents: 83e65c5
Author: Jing Zhao <jing9@apache.org>
Authored: Fri Sep 25 14:21:23 2015 -0700
Committer: Jing Zhao <jing9@apache.org>
Committed: Fri Sep 25 14:21:23 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt         |  3 +++
 .../apache/hadoop/hdfs/tools/NNHAServiceTarget.java | 16 +++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/83e99d06/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 8c26a1d..756f3f5 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -965,6 +965,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-5795. RemoteBlockReader2#checkSuccess() shoud print error status.
     (Xiao Chen via Yongjun Zhang)
 
+    HDFS-9112. Improve error message for Haadmin when multiple name service IDs
+    are configured. (Anu Engineer via jing9)
+
   OPTIMIZATIONS
 
     HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

http://git-wip-us.apache.org/repos/asf/hadoop/blob/83e99d06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/NNHAServiceTarget.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/NNHAServiceTarget.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/NNHAServiceTarget.java
index 6615a4f..247ac02 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/NNHAServiceTarget.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/NNHAServiceTarget.java
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hdfs.tools;
 
 import java.net.InetSocketAddress;
+import java.util.Arrays;
 import java.util.Map;
 
 import org.apache.hadoop.classification.InterfaceAudience;
@@ -34,6 +35,8 @@ import org.apache.hadoop.net.NetUtils;
 
 import com.google.common.base.Preconditions;
 
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMESERVICES;
+
 /**
  * One of the NN NameNodes acting as the target of an administrative command
  * (e.g. failover).
@@ -56,12 +59,19 @@ public class NNHAServiceTarget extends HAServiceTarget {
   public NNHAServiceTarget(Configuration conf,
       String nsId, String nnId) {
     Preconditions.checkNotNull(nnId);
-    
+
     if (nsId == null) {
       nsId = DFSUtil.getOnlyNameServiceIdOrNull(conf);
       if (nsId == null) {
-        throw new IllegalArgumentException(
-            "Unable to determine the nameservice id.");
+        String errorString = "Unable to determine the name service ID.";
+        String[] dfsNames = conf.getStrings(DFS_NAMESERVICES);
+        if ((dfsNames != null) && (dfsNames.length > 1)) {
+          errorString = "Unable to determine the name service ID. " +
+              "This is an HA configuration with multiple name services " +
+              "configured. " + DFS_NAMESERVICES + " is set to " +
+              Arrays.toString(dfsNames) + ". Please re-run with the -ns option.";
+        }
+        throw new IllegalArgumentException(errorString);
       }
     }
     assert nsId != null;


Mime
View raw message