You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ji...@apache.org on 2015/05/20 23:53:09 UTC

hadoop git commit: HDFS-8427. Remove dataBlockNum and parityBlockNum from BlockInfoStriped. Contributed by Kai Sasaki.

Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7285 4dd4aa577 -> 0d1d4218d


HDFS-8427. Remove dataBlockNum and parityBlockNum from BlockInfoStriped. Contributed by Kai Sasaki.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0d1d4218
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0d1d4218
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0d1d4218

Branch: refs/heads/HDFS-7285
Commit: 0d1d4218df0a165800a7f5fe61c8487e994c5062
Parents: 4dd4aa5
Author: Jing Zhao <ji...@apache.org>
Authored: Wed May 20 14:52:51 2015 -0700
Committer: Jing Zhao <ji...@apache.org>
Committed: Wed May 20 14:52:51 2015 -0700

----------------------------------------------------------------------
 .../hadoop-hdfs/CHANGES-HDFS-EC-7285.txt             |  3 +++
 .../server/blockmanagement/BlockInfoStriped.java     | 15 ++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0d1d4218/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
index b608b10..610a5eb 100755
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
@@ -241,3 +241,6 @@
 
     HDFS-8323. Bump GenerationStamp for write faliure in DFSStripedOutputStream.
     (Tsz Wo Nicholas Sze via jing9)
+
+    HDFS-8427. Remove dataBlockNum and parityBlockNum from BlockInfoStriped.
+    (Kai Sasaki via jing9)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0d1d4218/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoStriped.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoStriped.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoStriped.java
index d7a48a0..3898a49 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoStriped.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoStriped.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hdfs.server.blockmanagement;
 
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.BlockUCState;
-import org.apache.hadoop.hdfs.server.namenode.ErasureCodingSchemaManager;
 import org.apache.hadoop.hdfs.util.StripedBlockUtil;
 import org.apache.hadoop.io.erasurecode.ECSchema;
 
@@ -39,8 +38,6 @@ import static org.apache.hadoop.hdfs.protocol.HdfsConstants.BLOCK_STRIPED_CELL_S
  * array to record the block index for each triplet.
  */
 public class BlockInfoStriped extends BlockInfo {
-  private final short dataBlockNum;
-  private final short parityBlockNum;
   private final ECSchema schema;
   /**
    * Always the same size with triplets. Record the block index for each triplet
@@ -54,8 +51,6 @@ public class BlockInfoStriped extends BlockInfo {
     indices = new byte[schema.getNumDataUnits() + schema.getNumParityUnits()];
     initIndices();
     this.schema = schema;
-    this.dataBlockNum = (short)schema.getNumDataUnits();
-    this.parityBlockNum = (short)schema.getNumParityUnits();
   }
 
   BlockInfoStriped(BlockInfoStriped b) {
@@ -64,15 +59,16 @@ public class BlockInfoStriped extends BlockInfo {
   }
 
   public short getTotalBlockNum() {
-    return (short) (dataBlockNum + parityBlockNum);
+    return (short) (this.schema.getNumDataUnits()
+        + this.schema.getNumParityUnits());
   }
 
   public short getDataBlockNum() {
-    return dataBlockNum;
+    return (short) this.schema.getNumDataUnits();
   }
 
   public short getParityBlockNum() {
-    return parityBlockNum;
+    return (short) this.schema.getNumParityUnits();
   }
 
   public ECSchema getSchema() {
@@ -210,7 +206,8 @@ public class BlockInfoStriped extends BlockInfo {
     // be the total of data blocks and parity blocks because
     // `getNumBytes` is the total of actual data block size.
     return StripedBlockUtil.spaceConsumedByStripedBlock(getNumBytes(),
-        dataBlockNum, parityBlockNum, BLOCK_STRIPED_CELL_SIZE);
+        this.schema.getNumDataUnits(), this.schema.getNumParityUnits(),
+        BLOCK_STRIPED_CELL_SIZE);
     }
 
   @Override