|
@@ -278,11 +278,14 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
}
|
|
|
|
|
|
/** Construct a new output stream for append. */
|
|
|
- private DFSOutputStream(DFSClient dfsClient, String src, boolean toNewBlock,
|
|
|
- Progressable progress, LocatedBlock lastBlock, HdfsFileStatus stat,
|
|
|
- DataChecksum checksum) throws IOException {
|
|
|
+ private DFSOutputStream(DFSClient dfsClient, String src,
|
|
|
+ EnumSet<CreateFlag> flags, Progressable progress, LocatedBlock lastBlock,
|
|
|
+ HdfsFileStatus stat, DataChecksum checksum) throws IOException {
|
|
|
this(dfsClient, src, progress, stat, checksum);
|
|
|
initialFileSize = stat.getLen(); // length of file when opened
|
|
|
+ this.shouldSyncBlock = flags.contains(CreateFlag.SYNC_BLOCK);
|
|
|
+
|
|
|
+ boolean toNewBlock = flags.contains(CreateFlag.NEW_BLOCK);
|
|
|
|
|
|
this.fileEncryptionInfo = stat.getFileEncryptionInfo();
|
|
|
|
|
@@ -338,13 +341,13 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
}
|
|
|
|
|
|
static DFSOutputStream newStreamForAppend(DFSClient dfsClient, String src,
|
|
|
- boolean toNewBlock, int bufferSize, Progressable progress,
|
|
|
+ EnumSet<CreateFlag> flags, int bufferSize, Progressable progress,
|
|
|
LocatedBlock lastBlock, HdfsFileStatus stat, DataChecksum checksum,
|
|
|
String[] favoredNodes) throws IOException {
|
|
|
TraceScope scope =
|
|
|
dfsClient.getPathTraceScope("newStreamForAppend", src);
|
|
|
try {
|
|
|
- final DFSOutputStream out = new DFSOutputStream(dfsClient, src, toNewBlock,
|
|
|
+ final DFSOutputStream out = new DFSOutputStream(dfsClient, src, flags,
|
|
|
progress, lastBlock, stat, checksum);
|
|
|
if (favoredNodes != null && favoredNodes.length != 0) {
|
|
|
out.streamer.setFavoredNodes(favoredNodes);
|