From 3a89a8814f8e443a5f7ceddcecd6d953cfc2c6f3 Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Mon, 3 Oct 2016 09:26:41 -0500 Subject: [PATCH] HDFS-10619. Cache path in InodesInPath. Contributed by Daryn Sharp. (cherry picked from commit 90020624b05230ad4a7fbd666d0177ecb107a4d6) --- .../org/apache/hadoop/hdfs/server/namenode/INodesInPath.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodesInPath.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodesInPath.java index 04d3bdab3ca..f05fa377ef8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodesInPath.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodesInPath.java @@ -278,6 +278,8 @@ public class INodesInPath { } private final byte[][] path; + private final String pathname; + /** * Array with the specified number of INodes resolved for a given path. */ @@ -306,6 +308,7 @@ public class INodesInPath { Preconditions.checkArgument(inodes != null && path != null); this.inodes = inodes; this.path = path; + this.pathname = DFSUtil.byteArray2PathString(path); this.isRaw = isRaw; this.isSnapshot = isSnapshot; this.snapshotId = snapshotId; @@ -366,7 +369,7 @@ public class INodesInPath { /** @return the full path in string form */ public String getPath() { - return DFSUtil.byteArray2PathString(path); + return pathname; } public String getParentPath() {