HDFS-11648. Lazy construct the IIP pathname. Contributed by Daryn Sharp.

(cherry picked from commit 8ed230c805)
(cherry picked from commit 9dfe0b3515)
This commit is contained in:
Kihwal Lee 2017-04-12 13:30:41 -05:00 committed by Zhe Zhang
parent 81712e84fb
commit 1903665b23
2 changed files with 7 additions and 2 deletions

View File

@ -99,6 +99,9 @@ Release 2.7.4 - UNRELEASED
HDFS-10619. Cache path in InodesInPath. (daryn via kihwal, backported by zhz)
HDFS-11648. Lazy construct the IIP pathname.
(daryn via kihwal, backported by zhz)
OPTIMIZATIONS
HDFS-10896. Move lock logging logic from FSNamesystem into FSNamesystemLock.

View File

@ -270,7 +270,7 @@ public class INodesInPath {
}
private final byte[][] path;
private final String pathname;
private volatile String pathname;
/**
* Array with the specified number of INodes resolved for a given path.
@ -293,7 +293,6 @@ public class INodesInPath {
Preconditions.checkArgument(inodes != null && path != null);
this.inodes = inodes;
this.path = path;
this.pathname = DFSUtil.byteArray2PathString(path);
this.isSnapshot = isSnapshot;
this.snapshotId = snapshotId;
}
@ -349,6 +348,9 @@ public class INodesInPath {
/** @return the full path in string form */
public String getPath() {
if (pathname == null) {
pathname = DFSUtil.byteArray2PathString(path);
}
return pathname;
}