From 7e671f3b657fe5b8bd7a3946ee8e6b3f975564c5 Mon Sep 17 00:00:00 2001 From: He Xiaoqiao Date: Tue, 1 Sep 2020 11:35:55 +0800 Subject: [PATCH] HADOOP-17235. Erasure Coding: Remove dead code from common side. Contributed by Fei Hui. --- .../hadoop/io/erasurecode/ECBlockGroup.java | 28 ------------------- .../io/erasurecode/coder/ErasureDecoder.java | 23 --------------- .../hadoop/io/erasurecode/TestCoderBase.java | 8 ------ 3 files changed, 59 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECBlockGroup.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECBlockGroup.java index c52d9471bd..9dc3a3e777 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECBlockGroup.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/ECBlockGroup.java @@ -54,34 +54,6 @@ public ECBlock[] getParityBlocks() { return parityBlocks; } - /** - * Any erased data block? - * @return true if any erased data block, false otherwise - */ - public boolean anyErasedDataBlock() { - for (int i = 0; i < dataBlocks.length; ++i) { - if (dataBlocks[i].isErased()) { - return true; - } - } - - return false; - } - - /** - * Any erased parity block? - * @return true if any erased parity block, false otherwise - */ - public boolean anyErasedParityBlock() { - for (int i = 0; i < parityBlocks.length; ++i) { - if (parityBlocks[i].isErased()) { - return true; - } - } - - return false; - } - /** * Get erased blocks count * @return erased count of blocks diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/coder/ErasureDecoder.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/coder/ErasureDecoder.java index faf44d944e..004fd38df1 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/coder/ErasureDecoder.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/erasurecode/coder/ErasureDecoder.java @@ -172,27 +172,4 @@ protected int[] getErasedIndexes(ECBlock[] inputBlocks) { return erasedIndexes; } - - /** - * Get erased input blocks from inputBlocks - * @param inputBlocks - * @return an array of erased blocks from inputBlocks - */ - protected ECBlock[] getErasedBlocks(ECBlock[] inputBlocks) { - int numErased = getNumErasedBlocks(inputBlocks); - if (numErased == 0) { - return new ECBlock[0]; - } - - ECBlock[] erasedBlocks = new ECBlock[numErased]; - int i = 0, j = 0; - for (; i < inputBlocks.length && j < erasedBlocks.length; i++) { - if (inputBlocks[i].isErased()) { - erasedBlocks[j++] = inputBlocks[i]; - } - } - - return erasedBlocks; - } - } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestCoderBase.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestCoderBase.java index 6d14de8a52..caab72ceff 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestCoderBase.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/erasurecode/TestCoderBase.java @@ -66,10 +66,6 @@ public abstract class TestCoderBase { protected boolean allowChangeInputs; - protected int getChunkSize() { - return chunkSize; - } - protected void setChunkSize(int chunkSize) { this.chunkSize = chunkSize; this.zeroChunkBytes = new byte[chunkSize]; // With ZERO by default @@ -90,10 +86,6 @@ protected void prepareBufferAllocator(boolean usingSlicedBuffer) { } } - protected boolean isAllowDump() { - return allowDump; - } - /** * Prepare before running the case. * @param conf