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

Run "hdfs zkfc-formatZK" on a server in a non-namenode will cause a null pointer exception.

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.4-alpha, 2.4.0
    • 2.6.0
    • auto-failover, ha
    • None
    • Reviewed

    Description

      Run "hdfs zkfc-formatZK" on a server in a non-namenode will cause a null pointer exception.

      [hadoop@test bin]$ ./hdfs zkfc -formatZK
      Exception in thread "main" java.lang.NullPointerException
      at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
      at org.apache.hadoop.hdfs.tools.NNHAServiceTarget.<init>(NNHAServiceTarget.java:57)
      at org.apache.hadoop.hdfs.tools.DFSZKFailoverController.create(DFSZKFailoverController.java:128)
      at org.apache.hadoop.hdfs.tools.DFSZKFailoverController.main(DFSZKFailoverController.java:172)
      

      I look at the code, found in the org.apache.hadoop.hdfs.DFSUtil.getSuffixIDs () method does not make judgments on this issue.

      static String[] getSuffixIDs(final Configuration conf, final String addressKey,
            String knownNsId, String knownNNId,
            final AddressMatcher matcher) {
          String nameserviceId = null;
          String namenodeId = null;
          int found = 0;
         //......do something
      
         if (found > 1) { // Only one address must match the local address
            String msg = "Configuration has multiple addresses that match "
                + "local node's address. Please configure the system with "
                + DFS_NAMESERVICE_ID + " and "
                + DFS_HA_NAMENODE_ID_KEY;
            throw new HadoopIllegalArgumentException(msg);
          }
      
          // If the IP is not a local address, found to be less than 1.
          // There should be throw an exception with clear message rather than cause a null pointer exception.       
          return new String[] { nameserviceId, namenodeId };
      

      Attachments

        1. HADOOP-9603-0.patch
          1 kB
          Masatake Iwasaki

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            iwasakims Masatake Iwasaki
            mawenjin WenJin Ma
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 168h
                168h
                Remaining:
                Remaining Estimate - 168h
                168h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment