From efd60171528c2870d5c2a1465671b50710e2a52d Mon Sep 17 00:00:00 2001 From: Gang Liao Date: Sun, 22 Sep 2019 21:23:10 -0400 Subject: [PATCH] [FIX] root dir --- .../java/org/apache/hadoop/hdfs/server/namenode/INodeMap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeMap.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeMap.java index cad5d688a46..cef03b8a2f6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeMap.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeMap.java @@ -57,7 +57,7 @@ public INode get(long id) { INode inode = INodeKeyedObjects.getCache().getIfPresent(Long.class, id); if (inode == null) { DatabaseINode.LoadINode node = new DatabaseINode().loadINode(id); - byte[] name = (node.name != null) ? DFSUtil.string2Bytes(node.name) : null; + byte[] name = (node.name != null && node.length > 0) ? DFSUtil.string2Bytes(node.name) : null; if (node.header != 0L) { inode = new INodeFile(node.id); inode.asFile().setNumBlocks(); @@ -98,7 +98,7 @@ public INode get(long parentId, String childName) { .getIfPresent(Pair.class, new ImmutablePair<>((Long) parentId, childName)); if (inode == null) { DatabaseINode.LoadINode node = new DatabaseINode().loadINode(parentId, childName); - byte[] name = (node.name != null) ? DFSUtil.string2Bytes(node.name) : null; + byte[] name = (node.name != null && node.length > 0) ? DFSUtil.string2Bytes(node.name) : null; if (node.header != 0L) { inode = new INodeFile(node.id); inode.asFile().setNumBlocks();