|
@@ -360,6 +360,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
private long restartDeadline = 0; // Deadline of DN restart
|
|
|
private BlockConstructionStage stage; // block construction stage
|
|
|
private long bytesSent = 0; // number of bytes that've been sent
|
|
|
+ private final boolean isLazyPersistFile;
|
|
|
|
|
|
/** Nodes have been used in the pipeline before and have failed. */
|
|
|
private final List<DatanodeInfo> failed = new ArrayList<DatanodeInfo>();
|
|
@@ -377,14 +378,15 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
* Default construction for file create
|
|
|
*/
|
|
|
private DataStreamer() {
|
|
|
- this(null);
|
|
|
+ this(null, null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* construction with tracing info
|
|
|
*/
|
|
|
- private DataStreamer(Span span) {
|
|
|
+ private DataStreamer(HdfsFileStatus stat, Span span) {
|
|
|
isAppend = false;
|
|
|
+ isLazyPersistFile = stat.isLazyPersist();
|
|
|
stage = BlockConstructionStage.PIPELINE_SETUP_CREATE;
|
|
|
traceSpan = span;
|
|
|
}
|
|
@@ -404,6 +406,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
block = lastBlock.getBlock();
|
|
|
bytesSent = block.getNumBytes();
|
|
|
accessToken = lastBlock.getBlockToken();
|
|
|
+ isLazyPersistFile = stat.isLazyPersist();
|
|
|
long usedInLastBlock = stat.getLen() % blockSize;
|
|
|
int freeInLastBlock = (int)(blockSize - usedInLastBlock);
|
|
|
|
|
@@ -1396,7 +1399,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
new Sender(out).writeBlock(blockCopy, nodeStorageTypes[0], accessToken,
|
|
|
dfsClient.clientName, nodes, nodeStorageTypes, null, bcs,
|
|
|
nodes.length, block.getNumBytes(), bytesSent, newGS, checksum,
|
|
|
- cachingStrategy.get());
|
|
|
+ cachingStrategy.get(), isLazyPersistFile);
|
|
|
|
|
|
// receive ack for connect
|
|
|
BlockOpResponseProto resp = BlockOpResponseProto.parseFrom(
|
|
@@ -1649,7 +1652,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
if (Trace.isTracing()) {
|
|
|
traceSpan = Trace.startSpan(this.getClass().getSimpleName()).detach();
|
|
|
}
|
|
|
- streamer = new DataStreamer(traceSpan);
|
|
|
+ streamer = new DataStreamer(stat, traceSpan);
|
|
|
if (favoredNodes != null && favoredNodes.length != 0) {
|
|
|
streamer.setFavoredNodes(favoredNodes);
|
|
|
}
|
|
@@ -1726,7 +1729,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
} else {
|
|
|
computePacketChunkSize(dfsClient.getConf().writePacketSize,
|
|
|
checksum.getBytesPerChecksum());
|
|
|
- streamer = new DataStreamer(traceSpan);
|
|
|
+ streamer = new DataStreamer(stat, traceSpan);
|
|
|
}
|
|
|
this.fileEncryptionInfo = stat.getFileEncryptionInfo();
|
|
|
}
|