hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiten...@apache.org
Subject [05/50] [abbrv] hadoop git commit: HDFS-8113. Add check for null BlockCollection pointers in BlockInfoContiguous structures (Chengbing Liu via Colin P. McCabe)
Date Mon, 11 May 2015 22:54:39 GMT
HDFS-8113. Add check for null BlockCollection pointers in BlockInfoContiguous structures (Chengbing
Liu via Colin P. McCabe)


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

Branch: refs/heads/HDFS-7240
Commit: f523e963e4d88e4e459352387c6efeab59e7a809
Parents: c39012f
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Fri May 8 13:50:51 2015 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Fri May 8 13:50:51 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt              |  3 +++
 .../hdfs/server/blockmanagement/BlockInfoContiguous.java |  3 ++-
 .../hdfs/server/blockmanagement/TestBlockInfo.java       | 11 +++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/f523e963/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 1f80a62..b45caec 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -530,6 +530,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-8284. Update documentation about how to use HTrace with HDFS (Masatake
     Iwasaki via Colin P. McCabe)
 
+    HDFS-8113. Add check for null BlockCollection pointers in
+    BlockInfoContiguous structures (Chengbing Liu via Colin P. McCabe)
+
   OPTIMIZATIONS
 
     HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f523e963/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 4314ab3..df27882 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
@@ -74,7 +74,8 @@ public class BlockInfoContiguous extends Block
    * @param from BlockInfo to copy from.
    */
   protected BlockInfoContiguous(BlockInfoContiguous from) {
-    this(from, from.bc.getBlockReplication());
+    super(from);
+    this.triplets = new Object[from.triplets.length];
     this.bc = from.bc;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/f523e963/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java
index 6cee8b0..c5662ca 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java
@@ -69,6 +69,17 @@ public class TestBlockInfo {
     Assert.assertEquals(storage, blockInfo.getStorageInfo(0));
   }
 
+  @Test
+  public void testCopyConstructor() {
+    BlockInfoContiguous old = new BlockInfoContiguous((short) 3);
+    try {
+      BlockInfoContiguous copy = new BlockInfoContiguous(old);
+      assertEquals(old.getBlockCollection(), copy.getBlockCollection());
+      assertEquals(old.getCapacity(), copy.getCapacity());
+    } catch (Exception e) {
+      Assert.fail("Copy constructor throws exception: " + e);
+    }
+  }
 
   @Test
   public void testReplaceStorage() throws Exception {


Mime
View raw message