HADOOP-12808. Rename the RS coder from HDFS-RAID as legacy. Contributed by Rui Li.

Change-Id: Icb64eb60833fe0139aadb6da9aa666f664defc0e
This commit is contained in:
Zhe Zhang 2016-02-24 14:29:03 -08:00
parent d6b181c6fa
commit efdc0070d8
9 changed files with 48 additions and 19 deletions

View File

@ -653,6 +653,9 @@ Trunk (Unreleased)
HADOOP-12041. Implement another Reed-Solomon coder in pure Java. HADOOP-12041. Implement another Reed-Solomon coder in pure Java.
(Kai Zheng via zhz) (Kai Zheng via zhz)
HADOOP-12808. Rename the RS coder from HDFS-RAID as legacy.
(Rui Li via zhz)
Release 2.9.0 - UNRELEASED Release 2.9.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -43,7 +43,7 @@ public final class CodecUtil {
CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY,
true, numDataUnits, numParityUnits); true, numDataUnits, numParityUnits);
if (rawCoder == null) { if (rawCoder == null) {
rawCoder = new RSRawEncoder(numDataUnits, numParityUnits); rawCoder = new RSRawEncoderLegacy(numDataUnits, numParityUnits);
} }
return (RawErasureEncoder) rawCoder; return (RawErasureEncoder) rawCoder;
@ -62,7 +62,7 @@ public final class CodecUtil {
CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY,
false, numDataUnits, numParityUnits); false, numDataUnits, numParityUnits);
if (rawCoder == null) { if (rawCoder == null) {
rawCoder = new RSRawDecoder(numDataUnits, numParityUnits); rawCoder = new RSRawDecoderLegacy(numDataUnits, numParityUnits);
} }
return (RawErasureDecoder) rawCoder; return (RawErasureDecoder) rawCoder;

View File

@ -34,7 +34,7 @@ import java.nio.ByteBuffer;
* addressed in HADOOP-11871. * addressed in HADOOP-11871.
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
public class RSRawDecoder extends AbstractRawErasureDecoder { public class RSRawDecoderLegacy extends AbstractRawErasureDecoder {
// To describe and calculate the needed Vandermonde matrix // To describe and calculate the needed Vandermonde matrix
private int[] errSignature; private int[] errSignature;
private int[] primitivePower; private int[] primitivePower;
@ -61,7 +61,7 @@ public class RSRawDecoder extends AbstractRawErasureDecoder {
private ByteBuffer[] adjustedDirectBufferOutputsParameter = private ByteBuffer[] adjustedDirectBufferOutputsParameter =
new ByteBuffer[getNumParityUnits()]; new ByteBuffer[getNumParityUnits()];
public RSRawDecoder(int numDataUnits, int numParityUnits) { public RSRawDecoderLegacy(int numDataUnits, int numParityUnits) {
super(numDataUnits, numParityUnits); super(numDataUnits, numParityUnits);
if (numDataUnits + numParityUnits >= RSUtil.GF.getFieldSize()) { if (numDataUnits + numParityUnits >= RSUtil.GF.getFieldSize()) {
throw new HadoopIllegalArgumentException( throw new HadoopIllegalArgumentException(

View File

@ -29,10 +29,10 @@ import java.util.Arrays;
* when possible. * when possible.
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
public class RSRawEncoder extends AbstractRawErasureEncoder { public class RSRawEncoderLegacy extends AbstractRawErasureEncoder {
private int[] generatingPolynomial; private int[] generatingPolynomial;
public RSRawEncoder(int numDataUnits, int numParityUnits) { public RSRawEncoderLegacy(int numDataUnits, int numParityUnits) {
super(numDataUnits, numParityUnits); super(numDataUnits, numParityUnits);
assert (getNumDataUnits() + getNumParityUnits() < RSUtil.GF.getFieldSize()); assert (getNumDataUnits() + getNumParityUnits() < RSUtil.GF.getFieldSize());

View File

@ -20,18 +20,18 @@ package org.apache.hadoop.io.erasurecode.rawcoder;
import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceAudience;
/** /**
* A raw coder factory for raw Reed-Solomon coder in Java. * A raw coder factory for the legacy raw Reed-Solomon coder in Java.
*/ */
@InterfaceAudience.Private @InterfaceAudience.Private
public class RSRawErasureCoderFactory implements RawErasureCoderFactory { public class RSRawErasureCoderFactoryLegacy implements RawErasureCoderFactory {
@Override @Override
public RawErasureEncoder createEncoder(int numDataUnits, int numParityUnits) { public RawErasureEncoder createEncoder(int numDataUnits, int numParityUnits) {
return new RSRawEncoder(numDataUnits, numParityUnits); return new RSRawEncoderLegacy(numDataUnits, numParityUnits);
} }
@Override @Override
public RawErasureDecoder createDecoder(int numDataUnits, int numParityUnits) { public RawErasureDecoder createDecoder(int numDataUnits, int numParityUnits) {
return new RSRawDecoder(numDataUnits, numParityUnits); return new RSRawDecoderLegacy(numDataUnits, numParityUnits);
} }
} }

View File

@ -0,0 +1,27 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* General helpers for implementing raw erasure coders.
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
package org.apache.hadoop.io.erasurecode.rawcoder.util;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

View File

@ -19,7 +19,7 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactory; import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactoryLegacy;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -51,7 +51,7 @@ public class TestHHXORErasureCoder extends TestHHErasureCoderBase {
*/ */
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.set(CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, conf.set(CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY,
RSRawErasureCoderFactory.class.getCanonicalName()); RSRawErasureCoderFactoryLegacy.class.getCanonicalName());
prepare(conf, 10, 4, new int[]{0}, new int[0]); prepare(conf, 10, 4, new int[]{0}, new int[0]);
testCoding(true); testCoding(true);

View File

@ -19,7 +19,7 @@ package org.apache.hadoop.io.erasurecode.coder;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactory; import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactoryLegacy;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -58,7 +58,7 @@ public class TestRSErasureCoder extends TestErasureCoderBase {
*/ */
Configuration conf = new Configuration(); Configuration conf = new Configuration();
conf.set(CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, conf.set(CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY,
RSRawErasureCoderFactory.class.getCanonicalName()); RSRawErasureCoderFactoryLegacy.class.getCanonicalName());
prepare(conf, 10, 4, new int[]{0}, new int[0]); prepare(conf, 10, 4, new int[]{0}, new int[0]);
testCoding(true); testCoding(true);

View File

@ -18,17 +18,16 @@
package org.apache.hadoop.io.erasurecode.rawcoder; package org.apache.hadoop.io.erasurecode.rawcoder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test;
/** /**
* Test raw Reed-solomon coder implemented in Java. * Test the legacy raw Reed-solomon coder implemented in Java.
*/ */
public class TestRSRawCoder extends TestRSRawCoderBase { public class TestRSRawCoderLegacy extends TestRSRawCoderBase {
@Before @Before
public void setup() { public void setup() {
this.encoderClass = RSRawEncoder.class; this.encoderClass = RSRawEncoderLegacy.class;
this.decoderClass = RSRawDecoder.class; this.decoderClass = RSRawDecoderLegacy.class;
setAllowDump(false); // Change to true to allow verbose dump for debugging setAllowDump(false); // Change to true to allow verbose dump for debugging
} }
} }