HDFS-10619. Cache path in InodesInPath. Contributed by Daryn Sharp.

(cherry picked from commit 90020624b05230ad4a7fbd666d0177ecb107a4d6)
This commit is contained in:
Kihwal Lee 2016-10-03 09:20:08 -05:00
parent f8c2c7b2c0
commit 2ee47f02cf

View File

@ -278,6 +278,8 @@ public static INodesInPath append(INodesInPath iip, INode child,
} }
private final byte[][] path; private final byte[][] path;
private final String pathname;
/** /**
* Array with the specified number of INodes resolved for a given path. * Array with the specified number of INodes resolved for a given path.
*/ */
@ -306,6 +308,7 @@ private INodesInPath(INode[] inodes, byte[][] path, boolean isRaw,
Preconditions.checkArgument(inodes != null && path != null); Preconditions.checkArgument(inodes != null && path != null);
this.inodes = inodes; this.inodes = inodes;
this.path = path; this.path = path;
this.pathname = DFSUtil.byteArray2PathString(path);
this.isRaw = isRaw; this.isRaw = isRaw;
this.isSnapshot = isSnapshot; this.isSnapshot = isSnapshot;
this.snapshotId = snapshotId; this.snapshotId = snapshotId;
@ -366,7 +369,7 @@ public byte[] getPathComponent(int i) {
/** @return the full path in string form */ /** @return the full path in string form */
public String getPath() { public String getPath() {
return DFSUtil.byteArray2PathString(path); return pathname;
} }
public String getParentPath() { public String getParentPath() {