hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinayakum...@apache.org
Subject hadoop git commit: HDFS-8466. Refactor BlockInfoContiguous and fix NPE in TestBlockInfo#testCopyConstructor() (Contributed by Vinayakumar B)
Date Thu, 18 Jun 2015 08:45:37 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7285 c12a974cc -> 62c5a879e


HDFS-8466. Refactor BlockInfoContiguous and fix NPE in TestBlockInfo#testCopyConstructor()
(Contributed by Vinayakumar B)


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

Branch: refs/heads/HDFS-7285
Commit: 62c5a879ef2129b6d11752ccea099d461d29b4b7
Parents: c12a974
Author: Vinayakumar B <vinayakumarb@apache.org>
Authored: Thu Jun 18 14:15:01 2015 +0530
Committer: Vinayakumar B <vinayakumarb@apache.org>
Committed: Thu Jun 18 14:15:01 2015 +0530

----------------------------------------------------------------------
 .../blockmanagement/BlockInfoContiguous.java    | 57 ++------------------
 1 file changed, 4 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/62c5a879/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java
index 416091f..5199101 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockInfoContiguous.java
@@ -37,65 +37,16 @@ public class BlockInfoContiguous extends BlockInfo {
   }
 
   /**
-   * Copy construction.
-   * This is used to convert BlockReplicationInfoUnderConstruction
+   * Copy construction. This is used to convert
+   * BlockReplicationInfoUnderConstruction
+   *
    * @param from BlockReplicationInfo to copy from.
    */
   protected BlockInfoContiguous(BlockInfoContiguous from) {
-    this(from, from.getBlockCollection().getPreferredBlockReplication());
-    this.triplets = new Object[from.triplets.length];
+    this(from, (short) (from.triplets.length / 3));
     this.setBlockCollection(from.getBlockCollection());
   }
 
-  public DatanodeDescriptor getDatanode(int index) {
-    DatanodeStorageInfo storage = getStorageInfo(index);
-    return storage == null ? null : storage.getDatanodeDescriptor();
-  }
-
-  DatanodeStorageInfo getStorageInfo(int index) {
-    assert this.triplets != null : "BlockInfo is not initialized";
-    assert index >= 0 && index*3 < triplets.length : "Index is out of bound";
-    return (DatanodeStorageInfo)triplets[index*3];
-  }
-
-  /**
-   * Return the previous block on the block list for the datanode at
-   * position index. Set the previous block on the list to "to".
-   *
-   * @param index - the datanode index
-   * @param to - block to be set to previous on the list of blocks
-   * @return current previous block on the list of blocks
-   */
-  private BlockInfoContiguous setPrevious(int index, BlockInfoContiguous to) {
-    assert this.triplets != null : "BlockInfo is not initialized";
-    assert index >= 0 && index*3+1 < triplets.length : "Index is out of bound";
-    BlockInfoContiguous info = (BlockInfoContiguous)triplets[index*3+1];
-    triplets[index*3+1] = to;
-    return info;
-  }
-
-  /**
-   * Return the next block on the block list for the datanode at
-   * position index. Set the next block on the list to "to".
-   *
-   * @param index - the datanode index
-   * @param to - block to be set to next on the list of blocks
-   *    * @return current next block on the list of blocks
-   */
-  private BlockInfoContiguous setNext(int index, BlockInfoContiguous to) {
-    assert this.triplets != null : "BlockInfo is not initialized";
-    assert index >= 0 && index*3+2 < triplets.length : "Index is out of bound";
-    BlockInfoContiguous info = (BlockInfoContiguous)triplets[index*3+2];
-    triplets[index*3+2] = to;
-    return info;
-  }
-
-  public int getCapacity() {
-    assert this.triplets != null : "BlockInfo is not initialized";
-    assert triplets.length % 3 == 0 : "Malformed BlockInfo";
-    return triplets.length / 3;
-  }
-
   /**
    * Ensure that there is enough  space to include num more triplets.
    * @return first free triplet index.


Mime
View raw message