Bladeren bron

HDFS-7763. fix zkfc hung issue due to not catching exception in a corner case. Contributed by Liang Xie.

(cherry picked from commit 7105ebaa9f370db04962a1e19a67073dc080433b)
Andrew Wang 10 jaren geleden
bovenliggende
commit
efb7e287f4

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -720,6 +720,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7831. Fix the starting index and end condition of the loop in
     FileDiffList.findEarlierSnapshotBlocks(). (Konstantin Shvachko via jing9)
 
+    HDFS-7763. fix zkfc hung issue due to not catching exception in a corner
+    case. (Liang Xie via wang)
+
     BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
 
       HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

+ 7 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java

@@ -176,8 +176,13 @@ public class DFSZKFailoverController extends ZKFailoverController {
         new HdfsConfiguration(), args);
     DFSZKFailoverController zkfc = DFSZKFailoverController.create(
         parser.getConfiguration());
-    
-    System.exit(zkfc.run(parser.getRemainingArgs()));
+    int retCode = 0;
+    try {
+      retCode = zkfc.run(parser.getRemainingArgs());
+    } catch (Throwable t) {
+      LOG.fatal("Got a fatal error, exiting now", t);
+    }
+    System.exit(retCode);
   }
 
   @Override