HADOOP-14479. Erasurecode testcase failures with native enabled. Contributed by Sammi Chen

This commit is contained in:
Kai Zheng 2017-06-29 11:26:36 +08:00
parent 20ba86d66a
commit ea1da39b19
4 changed files with 15 additions and 9 deletions

View File

@ -62,6 +62,6 @@ public ECBlock[] getOutputBlocks() {
@Override
public void finish() {
rawEncoder.release();
// do nothing
}
}

View File

@ -31,7 +31,7 @@
typedef struct _XOREncoder {
IsalCoder isalCoder;
unsigned char* inputs[MMAX];
unsigned char* outputs[1];
unsigned char* outputs[KMAX];
} XORDecoder;
JNIEXPORT void JNICALL
@ -58,8 +58,7 @@ Java_org_apache_hadoop_io_erasurecode_rawcoder_NativeXORRawDecoder_decodeImpl(
numParityUnits = ((IsalCoder*)xorDecoder)->numParityUnits;
chunkSize = (int)dataLen;
getInputs(env, inputs, inputOffsets, xorDecoder->inputs,
numDataUnits + numParityUnits);
getInputs(env, inputs, inputOffsets, xorDecoder->inputs, numDataUnits);
getOutputs(env, outputs, outputOffsets, xorDecoder->outputs, numParityUnits);
for (i = 0; i < numDataUnits + numParityUnits; i++) {

View File

@ -31,7 +31,7 @@
typedef struct _XOREncoder {
IsalCoder isalCoder;
unsigned char* inputs[MMAX];
unsigned char* outputs[1];
unsigned char* outputs[KMAX];
} XOREncoder;
JNIEXPORT void JNICALL

View File

@ -18,11 +18,13 @@
package org.apache.hadoop.io.erasurecode;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.erasurecode.rawcoder.NativeRSRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.NativeRSRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.NativeRSRawErasureCoderFactory;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSLegacyRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSLegacyRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactory;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder;
@ -55,10 +57,15 @@ public void testRSDefaultRawCoder() {
// should return default raw coder of rs codec
RawErasureEncoder encoder = CodecUtil.createRawEncoder(
conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
Assert.assertTrue(encoder instanceof RSRawEncoder);
RawErasureDecoder decoder = CodecUtil.createRawDecoder(
conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
Assert.assertTrue(decoder instanceof RSRawDecoder);
if (ErasureCodeNative.isNativeCodeLoaded()) {
Assert.assertTrue(encoder instanceof NativeRSRawEncoder);
Assert.assertTrue(decoder instanceof NativeRSRawDecoder);
} else {
Assert.assertTrue(encoder instanceof RSRawEncoder);
Assert.assertTrue(decoder instanceof RSRawDecoder);
}
// should return default raw coder of rs-legacy codec
encoder = CodecUtil.createRawEncoder(conf,