|
@@ -344,6 +344,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>();
|
|
@@ -358,8 +359,9 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
/**
|
|
|
* Default construction for file create
|
|
|
*/
|
|
|
- private DataStreamer() {
|
|
|
+ private DataStreamer(HdfsFileStatus stat) {
|
|
|
isAppend = false;
|
|
|
+ isLazyPersistFile = stat.isLazyPersist();
|
|
|
stage = BlockConstructionStage.PIPELINE_SETUP_CREATE;
|
|
|
}
|
|
|
|
|
@@ -377,6 +379,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);
|
|
|
|
|
@@ -1352,7 +1355,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(
|
|
@@ -1601,7 +1604,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
computePacketChunkSize(dfsClient.getConf().writePacketSize,
|
|
|
checksum.getBytesPerChecksum());
|
|
|
|
|
|
- streamer = new DataStreamer();
|
|
|
+ streamer = new DataStreamer(stat);
|
|
|
if (favoredNodes != null && favoredNodes.length != 0) {
|
|
|
streamer.setFavoredNodes(favoredNodes);
|
|
|
}
|
|
@@ -1650,7 +1653,7 @@ public class DFSOutputStream extends FSOutputSummer
|
|
|
} else {
|
|
|
computePacketChunkSize(dfsClient.getConf().writePacketSize,
|
|
|
checksum.getBytesPerChecksum());
|
|
|
- streamer = new DataStreamer();
|
|
|
+ streamer = new DataStreamer(stat);
|
|
|
}
|
|
|
this.fileEncryptionInfo = stat.getFileEncryptionInfo();
|
|
|
}
|