Skip to content

Commit 528c72b

Browse files
committed
HDFS-17344. Last packet will be splited into two parts when write block.
1 parent 54f7a6b commit 528c72b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,9 @@ protected void adjustChunkBoundary() {
539539
int psize = 0;
540540
if (blockSize == getStreamer().getBytesCurBlock()) {
541541
psize = writePacketSize;
542+
} else if (blockSize - getStreamer().getBytesCurBlock() + PacketHeader.PKT_MAX_HEADER_LEN
543+
< writePacketSize) {
544+
psize = (int)(blockSize - getStreamer().getBytesCurBlock()) + PacketHeader.PKT_MAX_HEADER_LEN;
542545
} else {
543546
psize = (int) Math
544547
.min(blockSize - getStreamer().getBytesCurBlock(), writePacketSize);

0 commit comments

Comments
 (0)