Search in sources :

Example 6 with RawErasureEncoder

use of org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder in project hadoop by apache.

the class RSErasureEncoder method prepareEncodingStep.

@Override
protected ErasureCodingStep prepareEncodingStep(final ECBlockGroup blockGroup) {
    RawErasureEncoder rawEncoder = checkCreateRSRawEncoder();
    ECBlock[] inputBlocks = getInputBlocks(blockGroup);
    return new ErasureEncodingStep(inputBlocks, getOutputBlocks(blockGroup), rawEncoder);
}
Also used : RawErasureEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder) ECBlock(org.apache.hadoop.io.erasurecode.ECBlock)

Example 7 with RawErasureEncoder

use of org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder in project hadoop by apache.

the class XORErasureEncoder method prepareEncodingStep.

@Override
protected ErasureCodingStep prepareEncodingStep(final ECBlockGroup blockGroup) {
    RawErasureEncoder rawEncoder = CodecUtil.createRawEncoder(getConf(), ErasureCodeConstants.XOR_CODEC_NAME, getOptions());
    ECBlock[] inputBlocks = getInputBlocks(blockGroup);
    return new ErasureEncodingStep(inputBlocks, getOutputBlocks(blockGroup), rawEncoder);
}
Also used : RawErasureEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder) ECBlock(org.apache.hadoop.io.erasurecode.ECBlock)

Example 8 with RawErasureEncoder

use of org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder in project hadoop by apache.

the class TestCodecRawCoderMapping method testDedicatedRawCoderKey.

@Test
public void testDedicatedRawCoderKey() {
    ErasureCoderOptions coderOptions = new ErasureCoderOptions(numDataUnit, numParityUnit);
    String dummyFactName = "DummyNoneExistingFactory";
    // set the dummy factory to rs-legacy and create a raw coder
    // with rs, which is OK as the raw coder key is not used
    conf.set(CodecUtil.IO_ERASURECODE_CODEC_RS_LEGACY_RAWCODER_KEY, dummyFactName);
    RawErasureEncoder encoder = CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_CODEC_NAME, coderOptions);
    Assert.assertTrue(encoder instanceof RSRawEncoder);
    // now create the raw coder with rs-legacy, which should throw exception
    try {
        CodecUtil.createRawEncoder(conf, ErasureCodeConstants.RS_LEGACY_CODEC_NAME, coderOptions);
        Assert.fail();
    } catch (Exception e) {
        GenericTestUtils.assertExceptionContains("Failed to create raw coder", e);
    }
}
Also used : RSRawEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder) RawErasureEncoder(org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder) Test(org.junit.Test)

Aggregations

RawErasureEncoder (org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder)8 ECBlock (org.apache.hadoop.io.erasurecode.ECBlock)5 RSRawEncoder (org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder)2 RawErasureDecoder (org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder)2 Test (org.junit.Test)2 ErasureCoderOptions (org.apache.hadoop.io.erasurecode.ErasureCoderOptions)1 DummyRawEncoder (org.apache.hadoop.io.erasurecode.rawcoder.DummyRawEncoder)1 RSRawDecoder (org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder)1 RSRawDecoderLegacy (org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoderLegacy)1 RSRawEncoderLegacy (org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoderLegacy)1