HADOOP-11805 Better to rename some raw erasure coders. Contributed by Kai Zheng

This commit is contained in:
Kai Zheng 2015-04-08 01:26:40 +08:00 committed by Zhe Zhang
parent 146ce7a978
commit 17f7cdc047
14 changed files with 33 additions and 35 deletions

View File

@ -4,9 +4,9 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.erasurecode.ECBlock;
import org.apache.hadoop.io.erasurecode.ECBlockGroup;
import org.apache.hadoop.io.erasurecode.rawcoder.JRSRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XorRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XORRawDecoder;
/**
* Reed-Solomon erasure decoder that decodes a block group.
@ -56,7 +56,7 @@ public class RSErasureDecoder extends AbstractErasureDecoder {
rsRawDecoder = createRawDecoder(
CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY);
if (rsRawDecoder == null) {
rsRawDecoder = new JRSRawDecoder();
rsRawDecoder = new RSRawDecoder();
}
rsRawDecoder.initialize(getNumDataUnits(),
getNumParityUnits(), getChunkSize());
@ -66,7 +66,7 @@ public class RSErasureDecoder extends AbstractErasureDecoder {
private RawErasureDecoder checkCreateXorRawDecoder() {
if (xorRawDecoder == null) {
xorRawDecoder = new XorRawDecoder();
xorRawDecoder = new XORRawDecoder();
xorRawDecoder.initialize(getNumDataUnits(), 1, getChunkSize());
}
return xorRawDecoder;

View File

@ -3,7 +3,7 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.erasurecode.ECBlock;
import org.apache.hadoop.io.erasurecode.ECBlockGroup;
import org.apache.hadoop.io.erasurecode.rawcoder.JRSRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder;
/**
@ -30,7 +30,7 @@ public class RSErasureEncoder extends AbstractErasureEncoder {
rawEncoder = createRawEncoder(
CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY);
if (rawEncoder == null) {
rawEncoder = new JRSRawEncoder();
rawEncoder = new RSRawEncoder();
}
rawEncoder.initialize(getNumDataUnits(),
getNumParityUnits(), getChunkSize());

View File

@ -20,19 +20,19 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.io.erasurecode.ECBlock;
import org.apache.hadoop.io.erasurecode.ECBlockGroup;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XorRawDecoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XORRawDecoder;
/**
* Xor erasure decoder that decodes a block group.
*
* It implements {@link ErasureDecoder}.
*/
public class XorErasureDecoder extends AbstractErasureDecoder {
public class XORErasureDecoder extends AbstractErasureDecoder {
@Override
protected ErasureCodingStep prepareDecodingStep(final ECBlockGroup blockGroup) {
// May be configured
RawErasureDecoder rawDecoder = new XorRawDecoder();
RawErasureDecoder rawDecoder = new XORRawDecoder();
rawDecoder.initialize(getNumDataUnits(),
getNumParityUnits(), getChunkSize());

View File

@ -20,19 +20,19 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.io.erasurecode.ECBlock;
import org.apache.hadoop.io.erasurecode.ECBlockGroup;
import org.apache.hadoop.io.erasurecode.rawcoder.RawErasureEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XorRawEncoder;
import org.apache.hadoop.io.erasurecode.rawcoder.XORRawEncoder;
/**
* Xor erasure encoder that encodes a block group.
*
* It implements {@link ErasureEncoder}.
*/
public class XorErasureEncoder extends AbstractErasureEncoder {
public class XORErasureEncoder extends AbstractErasureEncoder {
@Override
protected ErasureCodingStep prepareEncodingStep(final ECBlockGroup blockGroup) {
// May be configured
RawErasureEncoder rawEncoder = new XorRawEncoder();
RawErasureEncoder rawEncoder = new XORRawEncoder();
rawEncoder.initialize(getNumDataUnits(),
getNumParityUnits(), getChunkSize());

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
* isn't available in some environment. Please always use native implementations
* when possible.
*/
public class JRSRawDecoder extends AbstractRawErasureDecoder {
public class RSRawDecoder extends AbstractRawErasureDecoder {
// To describe and calculate the needed Vandermonde matrix
private int[] errSignature;
private int[] primitivePower;

View File

@ -26,7 +26,7 @@ import java.nio.ByteBuffer;
* isn't available in some environment. Please always use native implementations
* when possible.
*/
public class JRSRawEncoder extends AbstractRawErasureEncoder {
public class RSRawEncoder extends AbstractRawErasureEncoder {
private int[] generatingPolynomial;
@Override

View File

@ -20,15 +20,15 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
/**
* A raw coder factory for raw Reed-Solomon coder in Java.
*/
public class JRSRawErasureCoderFactory implements RawErasureCoderFactory {
public class RSRawErasureCoderFactory implements RawErasureCoderFactory {
@Override
public RawErasureEncoder createEncoder() {
return new JRSRawEncoder();
return new RSRawEncoder();
}
@Override
public RawErasureDecoder createDecoder() {
return new JRSRawDecoder();
return new RSRawDecoder();
}
}

View File

@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
/**
* A raw decoder in XOR code scheme in pure Java, adapted from HDFS-RAID.
*/
public class XorRawDecoder extends AbstractRawErasureDecoder {
public class XORRawDecoder extends AbstractRawErasureDecoder {
@Override
protected void doDecode(ByteBuffer[] inputs, int[] erasedIndexes,

View File

@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
/**
* A raw encoder in XOR code scheme in pure Java, adapted from HDFS-RAID.
*/
public class XorRawEncoder extends AbstractRawErasureEncoder {
public class XORRawEncoder extends AbstractRawErasureEncoder {
@Override
protected void doEncode(ByteBuffer[] inputs, ByteBuffer[] outputs) {

View File

@ -20,15 +20,15 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
/**
* A raw coder factory for raw XOR coder.
*/
public class XorRawErasureCoderFactory implements RawErasureCoderFactory {
public class XORRawErasureCoderFactory implements RawErasureCoderFactory {
@Override
public RawErasureEncoder createEncoder() {
return new XorRawEncoder();
return new XORRawEncoder();
}
@Override
public RawErasureDecoder createDecoder() {
return new XorRawDecoder();
return new XORRawDecoder();
}
}

View File

@ -19,7 +19,7 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.erasurecode.rawcoder.JRSRawErasureCoderFactory;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactory;
import org.junit.Before;
import org.junit.Test;
@ -58,7 +58,7 @@ public class TestRSErasureCoder extends TestErasureCoderBase {
*/
Configuration conf = new Configuration();
conf.set(CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY,
JRSRawErasureCoderFactory.class.getCanonicalName());
RSRawErasureCoderFactory.class.getCanonicalName());
conf.setBoolean(
CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_USEXOR_KEY, false);
prepare(conf, 10, 4, null);

View File

@ -23,12 +23,12 @@ import org.junit.Test;
/**
* Test XOR encoding and decoding.
*/
public class TestXorCoder extends TestErasureCoderBase {
public class TestXORCoder extends TestErasureCoderBase {
@Before
public void setup() {
this.encoderClass = XorErasureEncoder.class;
this.decoderClass = XorErasureDecoder.class;
this.encoderClass = XORErasureEncoder.class;
this.decoderClass = XORErasureDecoder.class;
this.numDataUnits = 10;
this.numParityUnits = 1;

View File

@ -27,7 +27,7 @@ import java.nio.ByteBuffer;
/**
* Test raw Reed-solomon encoding and decoding.
*/
public class TestJRSRawCoder extends TestRawCoderBase {
public class TestRSRawCoder extends TestRawCoderBase {
private static int symbolSize = 0;
private static int symbolMax = 0;
@ -40,8 +40,8 @@ public class TestJRSRawCoder extends TestRawCoderBase {
@Before
public void setup() {
this.encoderClass = JRSRawEncoder.class;
this.decoderClass = JRSRawDecoder.class;
this.encoderClass = RSRawEncoder.class;
this.decoderClass = RSRawDecoder.class;
}
@Test

View File

@ -20,17 +20,15 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
import org.junit.Before;
import org.junit.Test;
import java.util.Random;
/**
* Test XOR encoding and decoding.
*/
public class TestXorRawCoder extends TestRawCoderBase {
public class TestXORRawCoder extends TestRawCoderBase {
@Before
public void setup() {
this.encoderClass = XorRawEncoder.class;
this.decoderClass = XorRawDecoder.class;
this.encoderClass = XORRawEncoder.class;
this.decoderClass = XORRawDecoder.class;
this.numDataUnits = 10;
this.numParityUnits = 1;