hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [44/50] hadoop git commit: HDFS-12683. DFSZKFailOverController re-order logic for logging Exception. Contributed by Bharat Viswanadham.
Date Tue, 24 Oct 2017 00:41:36 GMT
HDFS-12683. DFSZKFailOverController re-order logic for logging Exception. Contributed by Bharat
Viswanadham.


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

Branch: refs/heads/HDFS-7240
Commit: 4b00c9a47f94c4d7c673710bbb3b85b5d2807e7b
Parents: 921338c
Author: Arpit Agarwal <arp@apache.org>
Authored: Mon Oct 23 10:47:16 2017 -0700
Committer: Arpit Agarwal <arp@apache.org>
Committed: Mon Oct 23 10:47:16 2017 -0700

----------------------------------------------------------------------
 .../apache/hadoop/ha/ZKFailoverController.java  | 48 ++++++++++++--------
 .../hdfs/tools/DFSZKFailoverController.java     |  3 +-
 2 files changed, 30 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4b00c9a4/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
index 20a4681..0ebdacd 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
@@ -184,40 +184,45 @@ public abstract class ZKFailoverController {
         }
       });
     } catch (RuntimeException rte) {
-      LOG.error("The failover controller encounters runtime error: " + rte);
       throw (Exception)rte.getCause();
     }
   }
   
 
   private int doRun(String[] args)
-      throws HadoopIllegalArgumentException, IOException, InterruptedException {
+      throws Exception {
     try {
       initZK();
     } catch (KeeperException ke) {
       LOG.error("Unable to start failover controller. Unable to connect "
           + "to ZooKeeper quorum at " + zkQuorum + ". Please check the "
           + "configured value for " + ZK_QUORUM_KEY + " and ensure that "
-          + "ZooKeeper is running.");
+          + "ZooKeeper is running.", ke);
       return ERR_CODE_NO_ZK;
     }
-    if (args.length > 0) {
-      if ("-formatZK".equals(args[0])) {
-        boolean force = false;
-        boolean interactive = true;
-        for (int i = 1; i < args.length; i++) {
-          if ("-force".equals(args[i])) {
-            force = true;
-          } else if ("-nonInteractive".equals(args[i])) {
-            interactive = false;
-          } else {
-            badArg(args[i]);
+    try {
+      if (args.length > 0) {
+        if ("-formatZK".equals(args[0])) {
+          boolean force = false;
+          boolean interactive = true;
+          for (int i = 1; i < args.length; i++) {
+            if ("-force".equals(args[i])) {
+              force = true;
+            } else if ("-nonInteractive".equals(args[i])) {
+              interactive = false;
+            } else {
+              badArg(args[i]);
+            }
           }
+          return formatZK(force, interactive);
+        }
+        else {
+          badArg(args[0]);
         }
-        return formatZK(force, interactive);
-      } else {
-        badArg(args[0]);
       }
+    } catch (Exception e){
+      LOG.error("The failover controller encounters runtime error", e);
+      throw e;
     }
 
     if (!elector.parentZNodeExists()) {
@@ -236,11 +241,14 @@ public abstract class ZKFailoverController {
       return ERR_CODE_NO_FENCER;
     }
 
-    initRPC();
-    initHM();
-    startRPC();
     try {
+      initRPC();
+      initHM();
+      startRPC();
       mainLoop();
+    } catch (Exception e) {
+      LOG.error("The failover controller encounters runtime error: ", e);
+      throw e;
     } finally {
       rpcServer.stopAndJoin();
       

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4b00c9a4/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
index 01cd934..a454d73 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
@@ -194,7 +194,8 @@ public class DFSZKFailoverController extends ZKFailoverController {
     try {
       retCode = zkfc.run(parser.getRemainingArgs());
     } catch (Throwable t) {
-      LOG.fatal("Got a fatal error, exiting now", t);
+      LOG.fatal("DFSZKFailOverController exiting due to earlier exception "
+          + t);
     }
     System.exit(retCode);
   }


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