|
@@ -278,6 +278,7 @@ public class FSDirectory implements Closeable {
|
|
*/
|
|
*/
|
|
INodeFile addFile(String path, PermissionStatus permissions,
|
|
INodeFile addFile(String path, PermissionStatus permissions,
|
|
short replication, long preferredBlockSize,
|
|
short replication, long preferredBlockSize,
|
|
|
|
+ boolean isLazyPersist,
|
|
String clientName, String clientMachine)
|
|
String clientName, String clientMachine)
|
|
throws FileAlreadyExistsException, QuotaExceededException,
|
|
throws FileAlreadyExistsException, QuotaExceededException,
|
|
UnresolvedLinkException, SnapshotAccessControlException, AclException {
|
|
UnresolvedLinkException, SnapshotAccessControlException, AclException {
|
|
@@ -285,7 +286,7 @@ public class FSDirectory implements Closeable {
|
|
long modTime = now();
|
|
long modTime = now();
|
|
INodeFile newNode = new INodeFile(namesystem.allocateNewInodeId(), null,
|
|
INodeFile newNode = new INodeFile(namesystem.allocateNewInodeId(), null,
|
|
permissions, modTime, modTime, BlockInfo.EMPTY_ARRAY, replication,
|
|
permissions, modTime, modTime, BlockInfo.EMPTY_ARRAY, replication,
|
|
- preferredBlockSize);
|
|
|
|
|
|
+ preferredBlockSize, isLazyPersist);
|
|
newNode.toUnderConstruction(clientName, clientMachine);
|
|
newNode.toUnderConstruction(clientName, clientMachine);
|
|
|
|
|
|
boolean added = false;
|
|
boolean added = false;
|
|
@@ -315,6 +316,7 @@ public class FSDirectory implements Closeable {
|
|
long modificationTime,
|
|
long modificationTime,
|
|
long atime,
|
|
long atime,
|
|
long preferredBlockSize,
|
|
long preferredBlockSize,
|
|
|
|
+ boolean isLazyPersist,
|
|
boolean underConstruction,
|
|
boolean underConstruction,
|
|
String clientName,
|
|
String clientName,
|
|
String clientMachine) {
|
|
String clientMachine) {
|
|
@@ -323,12 +325,12 @@ public class FSDirectory implements Closeable {
|
|
if (underConstruction) {
|
|
if (underConstruction) {
|
|
newNode = new INodeFile(id, null, permissions, modificationTime,
|
|
newNode = new INodeFile(id, null, permissions, modificationTime,
|
|
modificationTime, BlockInfo.EMPTY_ARRAY, replication,
|
|
modificationTime, BlockInfo.EMPTY_ARRAY, replication,
|
|
- preferredBlockSize);
|
|
|
|
|
|
+ preferredBlockSize, isLazyPersist);
|
|
newNode.toUnderConstruction(clientName, clientMachine);
|
|
newNode.toUnderConstruction(clientName, clientMachine);
|
|
|
|
|
|
} else {
|
|
} else {
|
|
newNode = new INodeFile(id, null, permissions, modificationTime, atime,
|
|
newNode = new INodeFile(id, null, permissions, modificationTime, atime,
|
|
- BlockInfo.EMPTY_ARRAY, replication, preferredBlockSize);
|
|
|
|
|
|
+ BlockInfo.EMPTY_ARRAY, replication, preferredBlockSize, isLazyPersist);
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -2283,11 +2285,13 @@ public class FSDirectory implements Closeable {
|
|
long size = 0; // length is zero for directories
|
|
long size = 0; // length is zero for directories
|
|
short replication = 0;
|
|
short replication = 0;
|
|
long blocksize = 0;
|
|
long blocksize = 0;
|
|
|
|
+ boolean isLazyPersist = false;
|
|
if (node.isFile()) {
|
|
if (node.isFile()) {
|
|
final INodeFile fileNode = node.asFile();
|
|
final INodeFile fileNode = node.asFile();
|
|
size = fileNode.computeFileSize(snapshot);
|
|
size = fileNode.computeFileSize(snapshot);
|
|
replication = fileNode.getFileReplication(snapshot);
|
|
replication = fileNode.getFileReplication(snapshot);
|
|
blocksize = fileNode.getPreferredBlockSize();
|
|
blocksize = fileNode.getPreferredBlockSize();
|
|
|
|
+ isLazyPersist = fileNode.getLazyPersistFlag();
|
|
}
|
|
}
|
|
int childrenNum = node.isDirectory() ?
|
|
int childrenNum = node.isDirectory() ?
|
|
node.asDirectory().getChildrenNum(snapshot) : 0;
|
|
node.asDirectory().getChildrenNum(snapshot) : 0;
|
|
@@ -2300,7 +2304,7 @@ public class FSDirectory implements Closeable {
|
|
node.isDirectory(),
|
|
node.isDirectory(),
|
|
replication,
|
|
replication,
|
|
blocksize,
|
|
blocksize,
|
|
- false,
|
|
|
|
|
|
+ isLazyPersist,
|
|
node.getModificationTime(snapshot),
|
|
node.getModificationTime(snapshot),
|
|
node.getAccessTime(snapshot),
|
|
node.getAccessTime(snapshot),
|
|
getPermissionForFileStatus(node, snapshot),
|
|
getPermissionForFileStatus(node, snapshot),
|
|
@@ -2322,6 +2326,7 @@ public class FSDirectory implements Closeable {
|
|
long size = 0; // length is zero for directories
|
|
long size = 0; // length is zero for directories
|
|
short replication = 0;
|
|
short replication = 0;
|
|
long blocksize = 0;
|
|
long blocksize = 0;
|
|
|
|
+ boolean isLazyPersist = false;
|
|
LocatedBlocks loc = null;
|
|
LocatedBlocks loc = null;
|
|
final FileEncryptionInfo feInfo = isRawPath ? null :
|
|
final FileEncryptionInfo feInfo = isRawPath ? null :
|
|
getFileEncryptionInfo(node, snapshot);
|
|
getFileEncryptionInfo(node, snapshot);
|
|
@@ -2329,7 +2334,7 @@ public class FSDirectory implements Closeable {
|
|
final INodeFile fileNode = node.asFile();
|
|
final INodeFile fileNode = node.asFile();
|
|
size = fileNode.computeFileSize(snapshot);
|
|
size = fileNode.computeFileSize(snapshot);
|
|
replication = fileNode.getFileReplication(snapshot);
|
|
replication = fileNode.getFileReplication(snapshot);
|
|
- blocksize = fileNode.getPreferredBlockSize();
|
|
|
|
|
|
+ isLazyPersist = fileNode.getLazyPersistFlag();
|
|
|
|
|
|
final boolean inSnapshot = snapshot != Snapshot.CURRENT_STATE_ID;
|
|
final boolean inSnapshot = snapshot != Snapshot.CURRENT_STATE_ID;
|
|
final boolean isUc = !inSnapshot && fileNode.isUnderConstruction();
|
|
final boolean isUc = !inSnapshot && fileNode.isUnderConstruction();
|
|
@@ -2348,7 +2353,7 @@ public class FSDirectory implements Closeable {
|
|
|
|
|
|
HdfsLocatedFileStatus status =
|
|
HdfsLocatedFileStatus status =
|
|
new HdfsLocatedFileStatus(size, node.isDirectory(), replication,
|
|
new HdfsLocatedFileStatus(size, node.isDirectory(), replication,
|
|
- blocksize, false, node.getModificationTime(snapshot),
|
|
|
|
|
|
+ blocksize, isLazyPersist, node.getModificationTime(snapshot),
|
|
node.getAccessTime(snapshot),
|
|
node.getAccessTime(snapshot),
|
|
getPermissionForFileStatus(node, snapshot),
|
|
getPermissionForFileStatus(node, snapshot),
|
|
node.getUserName(snapshot), node.getGroupName(snapshot),
|
|
node.getUserName(snapshot), node.getGroupName(snapshot),
|