HADOOP-12808. Rename the RS coder from HDFS-RAID as legacy. Contributed by Rui Li.
Change-Id: Icb64eb60833fe0139aadb6da9aa666f664defc0e Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/efdc0070 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/efdc0070 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/efdc0070 Branch: refs/heads/HDFS-1312 Commit: efdc0070d880c7e1b778e0029a1b827ca962ce70 Parents: d6b181c Author: Zhe Zhang <[email protected]> Authored: Wed Feb 24 14:29:03 2016 -0800 Committer: Zhe Zhang <[email protected]> Committed: Wed Feb 24 14:29:03 2016 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 + .../apache/hadoop/io/erasurecode/CodecUtil.java | 4 +- .../io/erasurecode/rawcoder/RSRawDecoder.java | 286 ------------------- .../rawcoder/RSRawDecoderLegacy.java | 286 +++++++++++++++++++ .../io/erasurecode/rawcoder/RSRawEncoder.java | 111 ------- .../rawcoder/RSRawEncoderLegacy.java | 111 +++++++ .../rawcoder/RSRawErasureCoderFactory.java | 37 --- .../RSRawErasureCoderFactoryLegacy.java | 37 +++ .../erasurecode/rawcoder/util/package-info.java | 27 ++ .../coder/TestHHXORErasureCoder.java | 4 +- .../erasurecode/coder/TestRSErasureCoder.java | 4 +- .../io/erasurecode/rawcoder/TestRSRawCoder.java | 34 --- .../rawcoder/TestRSRawCoderLegacy.java | 33 +++ 13 files changed, 503 insertions(+), 474 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 8fd61f0..c91820e 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -653,6 +653,9 @@ Trunk (Unreleased) HADOOP-12041. Implement another Reed-Solomon coder in pure Java. (Kai Zheng via zhz) + HADOOP-12808. Rename the RS coder from HDFS-RAID as legacy. + (Rui Li via zhz) + Release 2.9.0 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java index 87bedf8..fd5bd67 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/CodecUtil.java @@ -43,7 +43,7 @@ public final class CodecUtil { CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, true, numDataUnits, numParityUnits); if (rawCoder == null) { - rawCoder = new RSRawEncoder(numDataUnits, numParityUnits); + rawCoder = new RSRawEncoderLegacy(numDataUnits, numParityUnits); } return (RawErasureEncoder) rawCoder; @@ -62,7 +62,7 @@ public final class CodecUtil { CommonConfigurationKeys.IO_ERASURECODE_CODEC_RS_RAWCODER_KEY, false, numDataUnits, numParityUnits); if (rawCoder == null) { - rawCoder = new RSRawDecoder(numDataUnits, numParityUnits); + rawCoder = new RSRawDecoderLegacy(numDataUnits, numParityUnits); } return (RawErasureDecoder) rawCoder; http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoder.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoder.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoder.java deleted file mode 100644 index b7ee49d..0000000 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoder.java +++ /dev/null @@ -1,286 +0,0 @@ -/** - * 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. - */ -package org.apache.hadoop.io.erasurecode.rawcoder; - -import org.apache.hadoop.HadoopIllegalArgumentException; -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.io.erasurecode.rawcoder.util.CoderUtil; -import org.apache.hadoop.io.erasurecode.rawcoder.util.RSUtil; - -import java.nio.ByteBuffer; - -/** - * A raw erasure decoder in RS code scheme in pure Java in case native one - * isn't available in some environment. Please always use native implementations - * when possible. - * - * Currently this implementation will compute and decode not to read units - * unnecessarily due to the underlying implementation limit in GF. This will be - * addressed in HADOOP-11871. - */ [email protected] -public class RSRawDecoder extends AbstractRawErasureDecoder { - // To describe and calculate the needed Vandermonde matrix - private int[] errSignature; - private int[] primitivePower; - - /** - * We need a set of reusable buffers either for the bytes array - * decoding version or direct buffer decoding version. Normally not both. - * - * For output, in addition to the valid buffers from the caller - * passed from above, we need to provide extra buffers for the internal - * decoding implementation. For output, the caller should provide no more - * than numParityUnits but at least one buffers. And the left buffers will be - * borrowed from either bytesArrayBuffers, for the bytes array version. - * - */ - // Reused buffers for decoding with bytes arrays - private byte[][] bytesArrayBuffers = new byte[getNumParityUnits()][]; - private byte[][] adjustedByteArrayOutputsParameter = - new byte[getNumParityUnits()][]; - private int[] adjustedOutputOffsets = new int[getNumParityUnits()]; - - // Reused buffers for decoding with direct ByteBuffers - private ByteBuffer[] directBuffers = new ByteBuffer[getNumParityUnits()]; - private ByteBuffer[] adjustedDirectBufferOutputsParameter = - new ByteBuffer[getNumParityUnits()]; - - public RSRawDecoder(int numDataUnits, int numParityUnits) { - super(numDataUnits, numParityUnits); - if (numDataUnits + numParityUnits >= RSUtil.GF.getFieldSize()) { - throw new HadoopIllegalArgumentException( - "Invalid numDataUnits and numParityUnits"); - } - - this.errSignature = new int[numParityUnits]; - this.primitivePower = RSUtil.getPrimitivePower(numDataUnits, - numParityUnits); - } - - @Override - public void decode(ByteBuffer[] inputs, int[] erasedIndexes, - ByteBuffer[] outputs) { - // Make copies avoiding affecting original ones; - ByteBuffer[] newInputs = new ByteBuffer[inputs.length]; - int[] newErasedIndexes = new int[erasedIndexes.length]; - ByteBuffer[] newOutputs = new ByteBuffer[outputs.length]; - - // Adjust the order to match with underlying requirements. - adjustOrder(inputs, newInputs, - erasedIndexes, newErasedIndexes, outputs, newOutputs); - - super.decode(newInputs, newErasedIndexes, newOutputs); - } - - @Override - public void decode(byte[][] inputs, int[] erasedIndexes, byte[][] outputs) { - // Make copies avoiding affecting original ones; - byte[][] newInputs = new byte[inputs.length][]; - int[] newErasedIndexes = new int[erasedIndexes.length]; - byte[][] newOutputs = new byte[outputs.length][]; - - // Adjust the order to match with underlying requirements. - adjustOrder(inputs, newInputs, - erasedIndexes, newErasedIndexes, outputs, newOutputs); - - super.decode(newInputs, newErasedIndexes, newOutputs); - } - - private void doDecodeImpl(ByteBuffer[] inputs, int[] erasedIndexes, - ByteBuffer[] outputs) { - ByteBuffer valid = CoderUtil.findFirstValidInput(inputs); - int dataLen = valid.remaining(); - for (int i = 0; i < erasedIndexes.length; i++) { - errSignature[i] = primitivePower[erasedIndexes[i]]; - RSUtil.GF.substitute(inputs, dataLen, outputs[i], primitivePower[i]); - } - - RSUtil.GF.solveVandermondeSystem(errSignature, - outputs, erasedIndexes.length); - } - - private void doDecodeImpl(byte[][] inputs, int[] inputOffsets, - int dataLen, int[] erasedIndexes, - byte[][] outputs, int[] outputOffsets) { - for (int i = 0; i < erasedIndexes.length; i++) { - errSignature[i] = primitivePower[erasedIndexes[i]]; - RSUtil.GF.substitute(inputs, inputOffsets, dataLen, outputs[i], - outputOffsets[i], primitivePower[i]); - } - - RSUtil.GF.solveVandermondeSystem(errSignature, outputs, outputOffsets, - erasedIndexes.length, dataLen); - } - - @Override - protected void doDecode(byte[][] inputs, int[] inputOffsets, - int dataLen, int[] erasedIndexes, - byte[][] outputs, int[] outputOffsets) { - /** - * As passed parameters are friendly to callers but not to the underlying - * implementations, so we have to adjust them before calling doDecodeImpl. - */ - - int[] erasedOrNotToReadIndexes = - CoderUtil.getErasedOrNotToReadIndexes(inputs); - - // Prepare for adjustedOutputsParameter - - // First reset the positions needed this time - for (int i = 0; i < erasedOrNotToReadIndexes.length; i++) { - adjustedByteArrayOutputsParameter[i] = null; - adjustedOutputOffsets[i] = 0; - } - // Use the caller passed buffers in erasedIndexes positions - for (int outputIdx = 0, i = 0; i < erasedIndexes.length; i++) { - boolean found = false; - for (int j = 0; j < erasedOrNotToReadIndexes.length; j++) { - // If this index is one requested by the caller via erasedIndexes, then - // we use the passed output buffer to avoid copying data thereafter. - if (erasedIndexes[i] == erasedOrNotToReadIndexes[j]) { - found = true; - adjustedByteArrayOutputsParameter[j] = resetBuffer( - outputs[outputIdx], outputOffsets[outputIdx], dataLen); - adjustedOutputOffsets[j] = outputOffsets[outputIdx]; - outputIdx++; - } - } - if (!found) { - throw new HadoopIllegalArgumentException( - "Inputs not fully corresponding to erasedIndexes in null places"); - } - } - // Use shared buffers for other positions (not set yet) - for (int bufferIdx = 0, i = 0; i < erasedOrNotToReadIndexes.length; i++) { - if (adjustedByteArrayOutputsParameter[i] == null) { - adjustedByteArrayOutputsParameter[i] = resetBuffer( - checkGetBytesArrayBuffer(bufferIdx, dataLen), 0, dataLen); - adjustedOutputOffsets[i] = 0; // Always 0 for such temp output - bufferIdx++; - } - } - - doDecodeImpl(inputs, inputOffsets, dataLen, erasedOrNotToReadIndexes, - adjustedByteArrayOutputsParameter, adjustedOutputOffsets); - } - - @Override - protected void doDecode(ByteBuffer[] inputs, int[] erasedIndexes, - ByteBuffer[] outputs) { - ByteBuffer validInput = CoderUtil.findFirstValidInput(inputs); - int dataLen = validInput.remaining(); - - /** - * As passed parameters are friendly to callers but not to the underlying - * implementations, so we have to adjust them before calling doDecodeImpl. - */ - - int[] erasedOrNotToReadIndexes = - CoderUtil.getErasedOrNotToReadIndexes(inputs); - - // Prepare for adjustedDirectBufferOutputsParameter - - // First reset the positions needed this time - for (int i = 0; i < erasedOrNotToReadIndexes.length; i++) { - adjustedDirectBufferOutputsParameter[i] = null; - } - // Use the caller passed buffers in erasedIndexes positions - for (int outputIdx = 0, i = 0; i < erasedIndexes.length; i++) { - boolean found = false; - for (int j = 0; j < erasedOrNotToReadIndexes.length; j++) { - // If this index is one requested by the caller via erasedIndexes, then - // we use the passed output buffer to avoid copying data thereafter. - if (erasedIndexes[i] == erasedOrNotToReadIndexes[j]) { - found = true; - adjustedDirectBufferOutputsParameter[j] = - resetBuffer(outputs[outputIdx++], dataLen); - } - } - if (!found) { - throw new HadoopIllegalArgumentException( - "Inputs not fully corresponding to erasedIndexes in null places"); - } - } - // Use shared buffers for other positions (not set yet) - for (int bufferIdx = 0, i = 0; i < erasedOrNotToReadIndexes.length; i++) { - if (adjustedDirectBufferOutputsParameter[i] == null) { - ByteBuffer buffer = checkGetDirectBuffer(bufferIdx, dataLen); - buffer.position(0); - buffer.limit(dataLen); - adjustedDirectBufferOutputsParameter[i] = resetBuffer(buffer, dataLen); - bufferIdx++; - } - } - - doDecodeImpl(inputs, erasedOrNotToReadIndexes, - adjustedDirectBufferOutputsParameter); - } - - /* - * Convert data units first order to parity units first order. - */ - private <T> void adjustOrder(T[] inputs, T[] inputs2, - int[] erasedIndexes, int[] erasedIndexes2, - T[] outputs, T[] outputs2) { - // Example: - // d0 d1 d2 d3 d4 d5 : p0 p1 p2 => p0 p1 p2 : d0 d1 d2 d3 d4 d5 - System.arraycopy(inputs, getNumDataUnits(), inputs2, - 0, getNumParityUnits()); - System.arraycopy(inputs, 0, inputs2, - getNumParityUnits(), getNumDataUnits()); - - int numErasedDataUnits = 0, numErasedParityUnits = 0; - int idx = 0; - for (int i = 0; i < erasedIndexes.length; i++) { - if (erasedIndexes[i] >= getNumDataUnits()) { - erasedIndexes2[idx++] = erasedIndexes[i] - getNumDataUnits(); - numErasedParityUnits++; - } - } - for (int i = 0; i < erasedIndexes.length; i++) { - if (erasedIndexes[i] < getNumDataUnits()) { - erasedIndexes2[idx++] = erasedIndexes[i] + getNumParityUnits(); - numErasedDataUnits++; - } - } - - // Copy for data units - System.arraycopy(outputs, numErasedDataUnits, outputs2, - 0, numErasedParityUnits); - // Copy for parity units - System.arraycopy(outputs, 0, outputs2, - numErasedParityUnits, numErasedDataUnits); - } - - private byte[] checkGetBytesArrayBuffer(int idx, int bufferLen) { - if (bytesArrayBuffers[idx] == null || - bytesArrayBuffers[idx].length < bufferLen) { - bytesArrayBuffers[idx] = new byte[bufferLen]; - } - return bytesArrayBuffers[idx]; - } - - private ByteBuffer checkGetDirectBuffer(int idx, int bufferLen) { - if (directBuffers[idx] == null || - directBuffers[idx].capacity() < bufferLen) { - directBuffers[idx] = ByteBuffer.allocateDirect(bufferLen); - } - return directBuffers[idx]; - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoderLegacy.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoderLegacy.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoderLegacy.java new file mode 100644 index 0000000..7c8fa59 --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawDecoderLegacy.java @@ -0,0 +1,286 @@ +/** + * 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. + */ +package org.apache.hadoop.io.erasurecode.rawcoder; + +import org.apache.hadoop.HadoopIllegalArgumentException; +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.io.erasurecode.rawcoder.util.CoderUtil; +import org.apache.hadoop.io.erasurecode.rawcoder.util.RSUtil; + +import java.nio.ByteBuffer; + +/** + * A raw erasure decoder in RS code scheme in pure Java in case native one + * isn't available in some environment. Please always use native implementations + * when possible. + * + * Currently this implementation will compute and decode not to read units + * unnecessarily due to the underlying implementation limit in GF. This will be + * addressed in HADOOP-11871. + */ [email protected] +public class RSRawDecoderLegacy extends AbstractRawErasureDecoder { + // To describe and calculate the needed Vandermonde matrix + private int[] errSignature; + private int[] primitivePower; + + /** + * We need a set of reusable buffers either for the bytes array + * decoding version or direct buffer decoding version. Normally not both. + * + * For output, in addition to the valid buffers from the caller + * passed from above, we need to provide extra buffers for the internal + * decoding implementation. For output, the caller should provide no more + * than numParityUnits but at least one buffers. And the left buffers will be + * borrowed from either bytesArrayBuffers, for the bytes array version. + * + */ + // Reused buffers for decoding with bytes arrays + private byte[][] bytesArrayBuffers = new byte[getNumParityUnits()][]; + private byte[][] adjustedByteArrayOutputsParameter = + new byte[getNumParityUnits()][]; + private int[] adjustedOutputOffsets = new int[getNumParityUnits()]; + + // Reused buffers for decoding with direct ByteBuffers + private ByteBuffer[] directBuffers = new ByteBuffer[getNumParityUnits()]; + private ByteBuffer[] adjustedDirectBufferOutputsParameter = + new ByteBuffer[getNumParityUnits()]; + + public RSRawDecoderLegacy(int numDataUnits, int numParityUnits) { + super(numDataUnits, numParityUnits); + if (numDataUnits + numParityUnits >= RSUtil.GF.getFieldSize()) { + throw new HadoopIllegalArgumentException( + "Invalid numDataUnits and numParityUnits"); + } + + this.errSignature = new int[numParityUnits]; + this.primitivePower = RSUtil.getPrimitivePower(numDataUnits, + numParityUnits); + } + + @Override + public void decode(ByteBuffer[] inputs, int[] erasedIndexes, + ByteBuffer[] outputs) { + // Make copies avoiding affecting original ones; + ByteBuffer[] newInputs = new ByteBuffer[inputs.length]; + int[] newErasedIndexes = new int[erasedIndexes.length]; + ByteBuffer[] newOutputs = new ByteBuffer[outputs.length]; + + // Adjust the order to match with underlying requirements. + adjustOrder(inputs, newInputs, + erasedIndexes, newErasedIndexes, outputs, newOutputs); + + super.decode(newInputs, newErasedIndexes, newOutputs); + } + + @Override + public void decode(byte[][] inputs, int[] erasedIndexes, byte[][] outputs) { + // Make copies avoiding affecting original ones; + byte[][] newInputs = new byte[inputs.length][]; + int[] newErasedIndexes = new int[erasedIndexes.length]; + byte[][] newOutputs = new byte[outputs.length][]; + + // Adjust the order to match with underlying requirements. + adjustOrder(inputs, newInputs, + erasedIndexes, newErasedIndexes, outputs, newOutputs); + + super.decode(newInputs, newErasedIndexes, newOutputs); + } + + private void doDecodeImpl(ByteBuffer[] inputs, int[] erasedIndexes, + ByteBuffer[] outputs) { + ByteBuffer valid = CoderUtil.findFirstValidInput(inputs); + int dataLen = valid.remaining(); + for (int i = 0; i < erasedIndexes.length; i++) { + errSignature[i] = primitivePower[erasedIndexes[i]]; + RSUtil.GF.substitute(inputs, dataLen, outputs[i], primitivePower[i]); + } + + RSUtil.GF.solveVandermondeSystem(errSignature, + outputs, erasedIndexes.length); + } + + private void doDecodeImpl(byte[][] inputs, int[] inputOffsets, + int dataLen, int[] erasedIndexes, + byte[][] outputs, int[] outputOffsets) { + for (int i = 0; i < erasedIndexes.length; i++) { + errSignature[i] = primitivePower[erasedIndexes[i]]; + RSUtil.GF.substitute(inputs, inputOffsets, dataLen, outputs[i], + outputOffsets[i], primitivePower[i]); + } + + RSUtil.GF.solveVandermondeSystem(errSignature, outputs, outputOffsets, + erasedIndexes.length, dataLen); + } + + @Override + protected void doDecode(byte[][] inputs, int[] inputOffsets, + int dataLen, int[] erasedIndexes, + byte[][] outputs, int[] outputOffsets) { + /** + * As passed parameters are friendly to callers but not to the underlying + * implementations, so we have to adjust them before calling doDecodeImpl. + */ + + int[] erasedOrNotToReadIndexes = + CoderUtil.getErasedOrNotToReadIndexes(inputs); + + // Prepare for adjustedOutputsParameter + + // First reset the positions needed this time + for (int i = 0; i < erasedOrNotToReadIndexes.length; i++) { + adjustedByteArrayOutputsParameter[i] = null; + adjustedOutputOffsets[i] = 0; + } + // Use the caller passed buffers in erasedIndexes positions + for (int outputIdx = 0, i = 0; i < erasedIndexes.length; i++) { + boolean found = false; + for (int j = 0; j < erasedOrNotToReadIndexes.length; j++) { + // If this index is one requested by the caller via erasedIndexes, then + // we use the passed output buffer to avoid copying data thereafter. + if (erasedIndexes[i] == erasedOrNotToReadIndexes[j]) { + found = true; + adjustedByteArrayOutputsParameter[j] = resetBuffer( + outputs[outputIdx], outputOffsets[outputIdx], dataLen); + adjustedOutputOffsets[j] = outputOffsets[outputIdx]; + outputIdx++; + } + } + if (!found) { + throw new HadoopIllegalArgumentException( + "Inputs not fully corresponding to erasedIndexes in null places"); + } + } + // Use shared buffers for other positions (not set yet) + for (int bufferIdx = 0, i = 0; i < erasedOrNotToReadIndexes.length; i++) { + if (adjustedByteArrayOutputsParameter[i] == null) { + adjustedByteArrayOutputsParameter[i] = resetBuffer( + checkGetBytesArrayBuffer(bufferIdx, dataLen), 0, dataLen); + adjustedOutputOffsets[i] = 0; // Always 0 for such temp output + bufferIdx++; + } + } + + doDecodeImpl(inputs, inputOffsets, dataLen, erasedOrNotToReadIndexes, + adjustedByteArrayOutputsParameter, adjustedOutputOffsets); + } + + @Override + protected void doDecode(ByteBuffer[] inputs, int[] erasedIndexes, + ByteBuffer[] outputs) { + ByteBuffer validInput = CoderUtil.findFirstValidInput(inputs); + int dataLen = validInput.remaining(); + + /** + * As passed parameters are friendly to callers but not to the underlying + * implementations, so we have to adjust them before calling doDecodeImpl. + */ + + int[] erasedOrNotToReadIndexes = + CoderUtil.getErasedOrNotToReadIndexes(inputs); + + // Prepare for adjustedDirectBufferOutputsParameter + + // First reset the positions needed this time + for (int i = 0; i < erasedOrNotToReadIndexes.length; i++) { + adjustedDirectBufferOutputsParameter[i] = null; + } + // Use the caller passed buffers in erasedIndexes positions + for (int outputIdx = 0, i = 0; i < erasedIndexes.length; i++) { + boolean found = false; + for (int j = 0; j < erasedOrNotToReadIndexes.length; j++) { + // If this index is one requested by the caller via erasedIndexes, then + // we use the passed output buffer to avoid copying data thereafter. + if (erasedIndexes[i] == erasedOrNotToReadIndexes[j]) { + found = true; + adjustedDirectBufferOutputsParameter[j] = + resetBuffer(outputs[outputIdx++], dataLen); + } + } + if (!found) { + throw new HadoopIllegalArgumentException( + "Inputs not fully corresponding to erasedIndexes in null places"); + } + } + // Use shared buffers for other positions (not set yet) + for (int bufferIdx = 0, i = 0; i < erasedOrNotToReadIndexes.length; i++) { + if (adjustedDirectBufferOutputsParameter[i] == null) { + ByteBuffer buffer = checkGetDirectBuffer(bufferIdx, dataLen); + buffer.position(0); + buffer.limit(dataLen); + adjustedDirectBufferOutputsParameter[i] = resetBuffer(buffer, dataLen); + bufferIdx++; + } + } + + doDecodeImpl(inputs, erasedOrNotToReadIndexes, + adjustedDirectBufferOutputsParameter); + } + + /* + * Convert data units first order to parity units first order. + */ + private <T> void adjustOrder(T[] inputs, T[] inputs2, + int[] erasedIndexes, int[] erasedIndexes2, + T[] outputs, T[] outputs2) { + // Example: + // d0 d1 d2 d3 d4 d5 : p0 p1 p2 => p0 p1 p2 : d0 d1 d2 d3 d4 d5 + System.arraycopy(inputs, getNumDataUnits(), inputs2, + 0, getNumParityUnits()); + System.arraycopy(inputs, 0, inputs2, + getNumParityUnits(), getNumDataUnits()); + + int numErasedDataUnits = 0, numErasedParityUnits = 0; + int idx = 0; + for (int i = 0; i < erasedIndexes.length; i++) { + if (erasedIndexes[i] >= getNumDataUnits()) { + erasedIndexes2[idx++] = erasedIndexes[i] - getNumDataUnits(); + numErasedParityUnits++; + } + } + for (int i = 0; i < erasedIndexes.length; i++) { + if (erasedIndexes[i] < getNumDataUnits()) { + erasedIndexes2[idx++] = erasedIndexes[i] + getNumParityUnits(); + numErasedDataUnits++; + } + } + + // Copy for data units + System.arraycopy(outputs, numErasedDataUnits, outputs2, + 0, numErasedParityUnits); + // Copy for parity units + System.arraycopy(outputs, 0, outputs2, + numErasedParityUnits, numErasedDataUnits); + } + + private byte[] checkGetBytesArrayBuffer(int idx, int bufferLen) { + if (bytesArrayBuffers[idx] == null || + bytesArrayBuffers[idx].length < bufferLen) { + bytesArrayBuffers[idx] = new byte[bufferLen]; + } + return bytesArrayBuffers[idx]; + } + + private ByteBuffer checkGetDirectBuffer(int idx, int bufferLen) { + if (directBuffers[idx] == null || + directBuffers[idx].capacity() < bufferLen) { + directBuffers[idx] = ByteBuffer.allocateDirect(bufferLen); + } + return directBuffers[idx]; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java deleted file mode 100644 index 0f25b2a..0000000 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoder.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * 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. - */ -package org.apache.hadoop.io.erasurecode.rawcoder; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.io.erasurecode.rawcoder.util.RSUtil; - -import java.nio.ByteBuffer; -import java.util.Arrays; - -/** - * A raw erasure encoder in RS code scheme in pure Java in case native one - * isn't available in some environment. Please always use native implementations - * when possible. - */ [email protected] -public class RSRawEncoder extends AbstractRawErasureEncoder { - private int[] generatingPolynomial; - - public RSRawEncoder(int numDataUnits, int numParityUnits) { - super(numDataUnits, numParityUnits); - - assert (getNumDataUnits() + getNumParityUnits() < RSUtil.GF.getFieldSize()); - - int[] primitivePower = RSUtil.getPrimitivePower(numDataUnits, - numParityUnits); - // compute generating polynomial - int[] gen = {1}; - int[] poly = new int[2]; - for (int i = 0; i < numParityUnits; i++) { - poly[0] = primitivePower[i]; - poly[1] = 1; - gen = RSUtil.GF.multiply(gen, poly); - } - // generating polynomial has all generating roots - generatingPolynomial = gen; - } - - @Override - protected void doEncode(ByteBuffer[] inputs, ByteBuffer[] outputs) { - // parity units + data units - ByteBuffer[] all = new ByteBuffer[outputs.length + inputs.length]; - - if (isAllowingChangeInputs()) { - System.arraycopy(outputs, 0, all, 0, outputs.length); - System.arraycopy(inputs, 0, all, outputs.length, inputs.length); - } else { - System.arraycopy(outputs, 0, all, 0, outputs.length); - - /** - * Note when this coder would be really (rarely) used in a production - * system, this can be optimized to cache and reuse the new allocated - * buffers avoiding reallocating. - */ - ByteBuffer tmp; - for (int i = 0; i < inputs.length; i++) { - tmp = ByteBuffer.allocate(inputs[i].remaining()); - tmp.put(inputs[i]); - tmp.flip(); - all[outputs.length + i] = tmp; - } - } - - // Compute the remainder - RSUtil.GF.remainder(all, generatingPolynomial); - } - - @Override - protected void doEncode(byte[][] inputs, int[] inputOffsets, - int dataLen, byte[][] outputs, - int[] outputOffsets) { - // parity units + data units - byte[][] all = new byte[outputs.length + inputs.length][]; - int[] allOffsets = new int[outputOffsets.length + inputOffsets.length]; - - if (isAllowingChangeInputs()) { - System.arraycopy(outputs, 0, all, 0, outputs.length); - System.arraycopy(inputs, 0, all, outputs.length, inputs.length); - - System.arraycopy(outputOffsets, 0, allOffsets, 0, outputOffsets.length); - System.arraycopy(inputOffsets, 0, allOffsets, - outputOffsets.length, inputOffsets.length); - } else { - System.arraycopy(outputs, 0, all, 0, outputs.length); - System.arraycopy(outputOffsets, 0, allOffsets, 0, outputOffsets.length); - - for (int i = 0; i < inputs.length; i++) { - all[outputs.length + i] = Arrays.copyOfRange(inputs[i], - inputOffsets[i], inputOffsets[i] + dataLen); - } - } - - // Compute the remainder - RSUtil.GF.remainder(all, allOffsets, dataLen, generatingPolynomial); - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoderLegacy.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoderLegacy.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoderLegacy.java new file mode 100644 index 0000000..8057720 --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawEncoderLegacy.java @@ -0,0 +1,111 @@ +/** + * 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. + */ +package org.apache.hadoop.io.erasurecode.rawcoder; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.io.erasurecode.rawcoder.util.RSUtil; + +import java.nio.ByteBuffer; +import java.util.Arrays; + +/** + * A raw erasure encoder in RS code scheme in pure Java in case native one + * isn't available in some environment. Please always use native implementations + * when possible. + */ [email protected] +public class RSRawEncoderLegacy extends AbstractRawErasureEncoder { + private int[] generatingPolynomial; + + public RSRawEncoderLegacy(int numDataUnits, int numParityUnits) { + super(numDataUnits, numParityUnits); + + assert (getNumDataUnits() + getNumParityUnits() < RSUtil.GF.getFieldSize()); + + int[] primitivePower = RSUtil.getPrimitivePower(numDataUnits, + numParityUnits); + // compute generating polynomial + int[] gen = {1}; + int[] poly = new int[2]; + for (int i = 0; i < numParityUnits; i++) { + poly[0] = primitivePower[i]; + poly[1] = 1; + gen = RSUtil.GF.multiply(gen, poly); + } + // generating polynomial has all generating roots + generatingPolynomial = gen; + } + + @Override + protected void doEncode(ByteBuffer[] inputs, ByteBuffer[] outputs) { + // parity units + data units + ByteBuffer[] all = new ByteBuffer[outputs.length + inputs.length]; + + if (isAllowingChangeInputs()) { + System.arraycopy(outputs, 0, all, 0, outputs.length); + System.arraycopy(inputs, 0, all, outputs.length, inputs.length); + } else { + System.arraycopy(outputs, 0, all, 0, outputs.length); + + /** + * Note when this coder would be really (rarely) used in a production + * system, this can be optimized to cache and reuse the new allocated + * buffers avoiding reallocating. + */ + ByteBuffer tmp; + for (int i = 0; i < inputs.length; i++) { + tmp = ByteBuffer.allocate(inputs[i].remaining()); + tmp.put(inputs[i]); + tmp.flip(); + all[outputs.length + i] = tmp; + } + } + + // Compute the remainder + RSUtil.GF.remainder(all, generatingPolynomial); + } + + @Override + protected void doEncode(byte[][] inputs, int[] inputOffsets, + int dataLen, byte[][] outputs, + int[] outputOffsets) { + // parity units + data units + byte[][] all = new byte[outputs.length + inputs.length][]; + int[] allOffsets = new int[outputOffsets.length + inputOffsets.length]; + + if (isAllowingChangeInputs()) { + System.arraycopy(outputs, 0, all, 0, outputs.length); + System.arraycopy(inputs, 0, all, outputs.length, inputs.length); + + System.arraycopy(outputOffsets, 0, allOffsets, 0, outputOffsets.length); + System.arraycopy(inputOffsets, 0, allOffsets, + outputOffsets.length, inputOffsets.length); + } else { + System.arraycopy(outputs, 0, all, 0, outputs.length); + System.arraycopy(outputOffsets, 0, allOffsets, 0, outputOffsets.length); + + for (int i = 0; i < inputs.length; i++) { + all[outputs.length + i] = Arrays.copyOfRange(inputs[i], + inputOffsets[i], inputOffsets[i] + dataLen); + } + } + + // Compute the remainder + RSUtil.GF.remainder(all, allOffsets, dataLen, generatingPolynomial); + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactory.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactory.java deleted file mode 100644 index b034cbf..0000000 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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. - */ -package org.apache.hadoop.io.erasurecode.rawcoder; - -import org.apache.hadoop.classification.InterfaceAudience; - -/** - * A raw coder factory for raw Reed-Solomon coder in Java. - */ [email protected] -public class RSRawErasureCoderFactory implements RawErasureCoderFactory { - - @Override - public RawErasureEncoder createEncoder(int numDataUnits, int numParityUnits) { - return new RSRawEncoder(numDataUnits, numParityUnits); - } - - @Override - public RawErasureDecoder createDecoder(int numDataUnits, int numParityUnits) { - return new RSRawDecoder(numDataUnits, numParityUnits); - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactoryLegacy.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactoryLegacy.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactoryLegacy.java new file mode 100644 index 0000000..5aa75e4 --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/RSRawErasureCoderFactoryLegacy.java @@ -0,0 +1,37 @@ +/** + * 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. + */ +package org.apache.hadoop.io.erasurecode.rawcoder; + +import org.apache.hadoop.classification.InterfaceAudience; + +/** + * A raw coder factory for the legacy raw Reed-Solomon coder in Java. + */ [email protected] +public class RSRawErasureCoderFactoryLegacy implements RawErasureCoderFactory { + + @Override + public RawErasureEncoder createEncoder(int numDataUnits, int numParityUnits) { + return new RSRawEncoderLegacy(numDataUnits, numParityUnits); + } + + @Override + public RawErasureDecoder createDecoder(int numDataUnits, int numParityUnits) { + return new RSRawDecoderLegacy(numDataUnits, numParityUnits); + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/util/package-info.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/util/package-info.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/util/package-info.java new file mode 100644 index 0000000..c2339ac --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/rawcoder/util/package-info.java @@ -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. + */ [email protected] [email protected] +package org.apache.hadoop.io.erasurecode.rawcoder.util; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHXORErasureCoder.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHXORErasureCoder.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHXORErasureCoder.java index ad346e0..6372d48 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHXORErasureCoder.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestHHXORErasureCoder.java @@ -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.RSRawErasureCoderFactory; +import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactoryLegacy; import org.junit.Before; import org.junit.Test; @@ -51,7 +51,7 @@ public class TestHHXORErasureCoder extends TestHHErasureCoderBase { */ Configuration conf = new Configuration(); 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]); testCoding(true); http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestRSErasureCoder.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestRSErasureCoder.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestRSErasureCoder.java index 56ccac37..213eee6 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestRSErasureCoder.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/coder/TestRSErasureCoder.java @@ -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.RSRawErasureCoderFactory; +import org.apache.hadoop.io.erasurecode.rawcoder.RSRawErasureCoderFactoryLegacy; import org.junit.Before; import org.junit.Rule; 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, - RSRawErasureCoderFactory.class.getCanonicalName()); + RSRawErasureCoderFactoryLegacy.class.getCanonicalName()); prepare(conf, 10, 4, new int[]{0}, new int[0]); testCoding(true); http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoder.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoder.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoder.java deleted file mode 100644 index 26458f3..0000000 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoder.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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. - */ -package org.apache.hadoop.io.erasurecode.rawcoder; - -import org.junit.Before; -import org.junit.Test; - -/** - * Test raw Reed-solomon coder implemented in Java. - */ -public class TestRSRawCoder extends TestRSRawCoderBase { - - @Before - public void setup() { - this.encoderClass = RSRawEncoder.class; - this.decoderClass = RSRawDecoder.class; - setAllowDump(false); // Change to true to allow verbose dump for debugging - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/efdc0070/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoderLegacy.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoderLegacy.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoderLegacy.java new file mode 100644 index 0000000..ef58e43 --- /dev/null +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/rawcoder/TestRSRawCoderLegacy.java @@ -0,0 +1,33 @@ +/** + * 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. + */ +package org.apache.hadoop.io.erasurecode.rawcoder; + +import org.junit.Before; + +/** + * Test the legacy raw Reed-solomon coder implemented in Java. + */ +public class TestRSRawCoderLegacy extends TestRSRawCoderBase { + + @Before + public void setup() { + this.encoderClass = RSRawEncoderLegacy.class; + this.decoderClass = RSRawDecoderLegacy.class; + setAllowDump(false); // Change to true to allow verbose dump for debugging + } +}
