HDFS-8744. Erasure Coding: the number of chunks in packet is not updated when writing parity data. Contributed by Li Bo
This commit is contained in:
parent
e692c7dd92
commit
f4098dfae4
|
@ -341,3 +341,6 @@
|
||||||
|
|
||||||
HDFS-8484. Erasure coding: Two contiguous blocks occupy IDs belong to same
|
HDFS-8484. Erasure coding: Two contiguous blocks occupy IDs belong to same
|
||||||
striped group. (Walter Su via jing9)
|
striped group. (Walter Su via jing9)
|
||||||
|
|
||||||
|
HDFS-8744. Erasure Coding: the number of chunks in packet is not updated
|
||||||
|
when writing parity data. (Li Bo)
|
||||||
|
|
|
@ -419,7 +419,7 @@ public class DFSOutputStream extends FSOutputSummer
|
||||||
|
|
||||||
currentPacket.writeChecksum(checksum, ckoff, cklen);
|
currentPacket.writeChecksum(checksum, ckoff, cklen);
|
||||||
currentPacket.writeData(b, offset, len);
|
currentPacket.writeData(b, offset, len);
|
||||||
currentPacket.incNumChunks();
|
currentPacket.incNumChunks(1);
|
||||||
streamer.incBytesCurBlock(len);
|
streamer.incBytesCurBlock(len);
|
||||||
|
|
||||||
// If packet is full, enqueue it for transmission
|
// If packet is full, enqueue it for transmission
|
||||||
|
|
|
@ -259,10 +259,10 @@ public class DFSPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* increase the number of chunks by one
|
* increase the number of chunks by n
|
||||||
*/
|
*/
|
||||||
synchronized void incNumChunks() {
|
synchronized void incNumChunks(int n) {
|
||||||
numChunks++;
|
numChunks += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -389,11 +389,13 @@ public class DFSStripedOutputStream extends DFSOutputStream {
|
||||||
int maxBytesToPacket = p.getMaxChunks() * bytesPerChecksum;
|
int maxBytesToPacket = p.getMaxChunks() * bytesPerChecksum;
|
||||||
int toWrite = byteBuffer.remaining() > maxBytesToPacket ?
|
int toWrite = byteBuffer.remaining() > maxBytesToPacket ?
|
||||||
maxBytesToPacket: byteBuffer.remaining();
|
maxBytesToPacket: byteBuffer.remaining();
|
||||||
int ckLen = ((toWrite - 1) / bytesPerChecksum + 1) * getChecksumSize();
|
int chunks = (toWrite - 1) / bytesPerChecksum + 1;
|
||||||
|
int ckLen = chunks * getChecksumSize();
|
||||||
p.writeChecksum(checksumBuf, ckOff, ckLen);
|
p.writeChecksum(checksumBuf, ckOff, ckLen);
|
||||||
ckOff += ckLen;
|
ckOff += ckLen;
|
||||||
p.writeData(byteBuffer, toWrite);
|
p.writeData(byteBuffer, toWrite);
|
||||||
getCurrentStreamer().incBytesCurBlock(toWrite);
|
getCurrentStreamer().incBytesCurBlock(toWrite);
|
||||||
|
p.incNumChunks(chunks);
|
||||||
packets.add(p);
|
packets.add(p);
|
||||||
}
|
}
|
||||||
return packets;
|
return packets;
|
||||||
|
|
Loading…
Reference in New Issue