HDFS-11648. Lazy construct the IIP pathname. Contributed by Daryn Sharp.
This commit is contained in:
parent
4dd6206547
commit
d4c01dde49
@ -238,7 +238,7 @@ public static INodesInPath append(INodesInPath iip, INode child,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final byte[][] path;
|
private final byte[][] path;
|
||||||
private final String pathname;
|
private volatile 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.
|
||||||
@ -268,7 +268,6 @@ 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;
|
||||||
@ -329,6 +328,9 @@ 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() {
|
||||||
|
if (pathname == null) {
|
||||||
|
pathname = DFSUtil.byteArray2PathString(path);
|
||||||
|
}
|
||||||
return pathname;
|
return pathname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user