HDFS-11964. Decoding inputs should be correctly prepared in pread. Contributed by Takanobu Asanuma

This commit is contained in:
Kai Zheng 2017-09-01 17:48:26 +08:00
parent 1b3b9938cf
commit 7a96033b15

View File

@ -57,6 +57,10 @@ boolean prepareParityChunk(int index) {
Preconditions.checkState(index >= dataBlkNum &&
alignedStripe.chunks[index] == null);
int bufLen = (int) alignedStripe.getSpanInBlock();
decodeInputs[index] = new ECChunk(codingBuffer.duplicate(), index * bufLen,
bufLen);
alignedStripe.chunks[index] =
new StripingChunk(decodeInputs[index].getBuffer());
@ -75,7 +79,7 @@ void initDecodeInputs(AlignedStripe alignedStripe) {
codingBuffer = dfsStripedInputStream.getBufferPool().
getBuffer(useDirectBuffer(), bufLen * bufCount);
ByteBuffer buffer;
for (int i = 0; i < decodeInputs.length; i++) {
for (int i = 0; i < dataBlkNum; i++) {
buffer = codingBuffer.duplicate();
decodeInputs[i] = new ECChunk(buffer, i * bufLen, bufLen);
}