|
@@ -185,6 +185,7 @@ import org.apache.hadoop.hdfs.protocol.DirectoryListing;
|
|
|
import org.apache.hadoop.hdfs.protocol.EncryptionZone;
|
|
|
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
|
+import org.apache.hadoop.hdfs.protocol.LastBlockWithStatus;
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType;
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction;
|
|
|
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
|
@@ -2888,7 +2889,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
/**
|
|
|
* Append to an existing file in the namespace.
|
|
|
*/
|
|
|
- LocatedBlock appendFile(
|
|
|
+ LastBlockWithStatus appendFile(
|
|
|
String src, String holder, String clientMachine, boolean logRetryCache)
|
|
|
throws IOException {
|
|
|
try {
|
|
@@ -2899,7 +2900,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private LocatedBlock appendFileInt(final String srcArg, String holder,
|
|
|
+ private LastBlockWithStatus appendFileInt(final String srcArg, String holder,
|
|
|
String clientMachine, boolean logRetryCache)
|
|
|
throws AccessControlException, SafeModeException,
|
|
|
FileAlreadyExistsException, FileNotFoundException,
|
|
@@ -2912,6 +2913,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
boolean skipSync = false;
|
|
|
LocatedBlock lb = null;
|
|
|
+ HdfsFileStatus stat = null;
|
|
|
FSPermissionChecker pc = getPermissionChecker();
|
|
|
checkOperation(OperationCategory.WRITE);
|
|
|
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
|
|
@@ -2921,6 +2923,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
checkNameNodeSafeMode("Cannot append to file" + src);
|
|
|
src = dir.resolvePath(pc, src, pathComponents);
|
|
|
lb = appendFileInternal(pc, src, holder, clientMachine, logRetryCache);
|
|
|
+ stat = dir.getFileInfo(src, false, FSDirectory.isReservedRawName(srcArg),
|
|
|
+ true);
|
|
|
} catch (StandbyException se) {
|
|
|
skipSync = true;
|
|
|
throw se;
|
|
@@ -2941,7 +2945,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
|
|
}
|
|
|
}
|
|
|
logAuditEvent(true, "append", srcArg);
|
|
|
- return lb;
|
|
|
+ return new LastBlockWithStatus(lb, stat);
|
|
|
}
|
|
|
|
|
|
ExtendedBlock getExtendedBlock(Block blk) {
|