You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "WenJin Ma (JIRA)" <ji...@apache.org> on 2013/05/28 08:32:20 UTC

[jira] [Created] (HADOOP-9603) Run "hdfs zkfc-formatZK" on a server in a non-namenode will cause a null pointer exception.

WenJin Ma created HADOOP-9603:
---------------------------------

             Summary: Run "hdfs zkfc-formatZK" on a server in a non-namenode  will cause a null pointer exception.
                 Key: HADOOP-9603
                 URL: https://issues.apache.org/jira/browse/HADOOP-9603
             Project: Hadoop Common
          Issue Type: Bug
          Components: auto-failover, fs
    Affects Versions: 2.0.4-alpha
            Reporter: WenJin Ma


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

{code}
[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)
{code}

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

{code}
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 };
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira