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
|
||||
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 @@ protected synchronized void writeChunk(byte[] b, int offset, int len,
|
||||
|
||||
currentPacket.writeChecksum(checksum, ckoff, cklen);
|
||||
currentPacket.writeData(b, offset, len);
|
||||
currentPacket.incNumChunks();
|
||||
currentPacket.incNumChunks(1);
|
||||
streamer.incBytesCurBlock(len);
|
||||
|
||||
// If packet is full, enqueue it for transmission
|
||||
|
@ -259,10 +259,10 @@ synchronized int getNumChunks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* increase the number of chunks by one
|
||||
* increase the number of chunks by n
|
||||
*/
|
||||
synchronized void incNumChunks() {
|
||||
numChunks++;
|
||||
synchronized void incNumChunks(int n) {
|
||||
numChunks += n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -389,11 +389,13 @@ private List<DFSPacket> generatePackets(
|
||||
int maxBytesToPacket = p.getMaxChunks() * bytesPerChecksum;
|
||||
int toWrite = byteBuffer.remaining() > maxBytesToPacket ?
|
||||
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);
|
||||
ckOff += ckLen;
|
||||
p.writeData(byteBuffer, toWrite);
|
||||
getCurrentStreamer().incBytesCurBlock(toWrite);
|
||||
p.incNumChunks(chunks);
|
||||
packets.add(p);
|
||||
}
|
||||
return packets;
|
||||
|
Loading…
Reference in New Issue
Block a user