You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "JiangHua Zhu (Jira)" <ji...@apache.org> on 2022/08/19 03:50:00 UTC

[jira] [Created] (HDFS-16733) Improve INode#isRoot()

JiangHua Zhu created HDFS-16733:
-----------------------------------

             Summary: Improve INode#isRoot()
                 Key: HDFS-16733
                 URL: https://issues.apache.org/jira/browse/HDFS-16733
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: namenode
    Affects Versions: 3.3.0
            Reporter: JiangHua Zhu


When constructing an INodeFile or INodeDirectory, it is usually necessary to give a name. For getLocalNameBytes, there are not many restrictions, such as null can be set. But an exception is thrown:
{code:java}
INodeDirectory root = new INodeDirectory(HdfsConstants.GRANDFATHER_INODE_ID, null, perm, 0L);
{code}

Some exceptions:
{code:java}
java.lang.NullPointerException
	at org.apache.hadoop.hdfs.server.namenode.INode.isRoot(INode.java:78)
	at org.apache.hadoop.hdfs.server.namenode.TestINodeFile.testIsRoot(TestINodeFile.java:1274)
{code}

Although these situations rarely occur in production environments, we should refine the implementation of isRoot() to avoid this exception. This can enhance system robustness.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org