Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14207

ZKFC should catch exception when ha configuration missing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.1, 3.0.3
    • 3.3.0, 3.2.1, 3.1.3
    • hdfs
    • None
    • Reviewed

    Description

      When i test hdfs zkfc with wrong configurations , i can not start zkfc process, and did not find any errors in log except command errors as bellow

      ERROR: Cannot set priority of zkfc process 59556

      Debug zkfc and deep into the code, i find that zkfc exit because of HadoopIllegalArgumentException. I think we should catch this exception and log it.
      Throwing HadoopIllegalArgumentException code is as follow

        public static DFSZKFailoverController create(Configuration conf) {
          Configuration localNNConf = DFSHAAdmin.addSecurityConfiguration(conf);
          String nsId = DFSUtil.getNamenodeNameServiceId(conf);
      
          if (!HAUtil.isHAEnabled(localNNConf, nsId)) {
            throw new HadoopIllegalArgumentException(
                "HA is not enabled for this namenode.");
          }
          String nnId = HAUtil.getNameNodeId(localNNConf, nsId);
          if (nnId == null) {
            String msg = "Could not get the namenode ID of this node. " +
                "You may run zkfc on the node other than namenode.";
            throw new HadoopIllegalArgumentException(msg);
          }
          NameNode.initializeGenericKeys(localNNConf, nsId, nnId);
          DFSUtil.setGenericConf(localNNConf, nsId, nnId, ZKFC_CONF_KEYS);
          
          NNHAServiceTarget localTarget = new NNHAServiceTarget(
              localNNConf, nsId, nnId);
          return new DFSZKFailoverController(localNNConf, localTarget);
        }
      

      In DFSZKFailoverController main function, we do not catch it and not log it

       public static void main(String args[])
            throws Exception {
          StringUtils.startupShutdownMessage(DFSZKFailoverController.class,
              args, LOG);
          if (DFSUtil.parseHelpArgument(args, 
              ZKFailoverController.USAGE, System.out, true)) {
            System.exit(0);
          }
          
          GenericOptionsParser parser = new GenericOptionsParser(
              new HdfsConfiguration(), args);
          DFSZKFailoverController zkfc = DFSZKFailoverController.create(
              parser.getConfiguration());
          try {
            System.exit(zkfc.run(parser.getRemainingArgs()));
          } catch (Throwable t) {
            LOG.error("DFSZKFailOverController exiting due to earlier exception "
                + t);
            terminate(1, t);
          }
        }
      

      Attachments

        1. HDFS-14207.001.patch
          1 kB
          Hui Fei

        Activity

          People

            ferhui Hui Fei
            ferhui Hui Fei
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: