hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1036641 - in /hadoop/hdfs/branches/branch-0.22: ./ src/c++/libhdfs/ src/contrib/hdfsproxy/ src/java/ src/java/org/apache/hadoop/hdfs/server/datanode/ src/test/hdfs/ src/test/hdfs/org/apache/hadoop/hdfs/ src/webapps/datanode/ src/webapps/hd...
Date Thu, 18 Nov 2010 21:25:42 GMT
Author: eli
Date: Thu Nov 18 21:25:41 2010
New Revision: 1036641

URL: http://svn.apache.org/viewvc?rev=1036641&view=rev
Log:
HDFS-1507. svn merge -c 1036303 from trunk

Modified:
    hadoop/hdfs/branches/branch-0.22/   (props changed)
    hadoop/hdfs/branches/branch-0.22/CHANGES.txt
    hadoop/hdfs/branches/branch-0.22/build.xml   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/c++/libhdfs/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/contrib/hdfsproxy/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/java/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java
  (props changed)
    hadoop/hdfs/branches/branch-0.22/src/test/hdfs/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/test/hdfs/org/apache/hadoop/hdfs/TestAbandonBlock.java
    hadoop/hdfs/branches/branch-0.22/src/webapps/datanode/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/webapps/hdfs/   (props changed)
    hadoop/hdfs/branches/branch-0.22/src/webapps/secondary/   (props changed)

Propchange: hadoop/hdfs/branches/branch-0.22/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -1,4 +1,4 @@
 /hadoop/core/branches/branch-0.19/hdfs:713112
 /hadoop/hdfs/branches/HDFS-265:796829-820463
 /hadoop/hdfs/branches/branch-0.21:820487
-/hadoop/hdfs/trunk:1036213
+/hadoop/hdfs/trunk:1036213,1036303

Modified: hadoop/hdfs/branches/branch-0.22/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/CHANGES.txt?rev=1036641&r1=1036640&r2=1036641&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.22/CHANGES.txt Thu Nov 18 21:25:41 2010
@@ -373,6 +373,8 @@ Release 0.22.0 - Unreleased
     HDFS-874. TestHDFSFileContextMainOperations fails on weirdly 
     configured DNS hosts. (Todd Lipcon via eli)
 
+    HDFS-1507. TestAbandonBlock should abandon a block. (eli)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Propchange: hadoop/hdfs/branches/branch-0.22/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/build.xml:779102
 /hadoop/hdfs/branches/HDFS-265/build.xml:796829-820463
 /hadoop/hdfs/branches/branch-0.21/build.xml:820487
-/hadoop/hdfs/trunk/build.xml:1036213
+/hadoop/hdfs/trunk/build.xml:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/c++/libhdfs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -1,3 +1,3 @@
 /hadoop/core/branches/branch-0.19/mapred/src/c++/libhdfs:713112
 /hadoop/core/trunk/src/c++/libhdfs:776175-784663
-/hadoop/hdfs/trunk/src/c++/libhdfs:1036213
+/hadoop/hdfs/trunk/src/c++/libhdfs:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/contrib/hdfsproxy/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/contrib/hdfsproxy:776175-784663
 /hadoop/hdfs/branches/HDFS-265/src/contrib/hdfsproxy:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/contrib/hdfsproxy:820487
-/hadoop/hdfs/trunk/src/contrib/hdfsproxy:1036213
+/hadoop/hdfs/trunk/src/contrib/hdfsproxy:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/hdfs:776175-785643,785929-786278
 /hadoop/hdfs/branches/HDFS-265/src/java:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/java:820487
-/hadoop/hdfs/trunk/src/java:1036213
+/hadoop/hdfs/trunk/src/java:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -4,4 +4,4 @@
 /hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java:776175-785643,785929-786278
 /hadoop/hdfs/branches/HDFS-265/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java:820487
-/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java:1036213
+/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/test/hdfs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/test/hdfs:776175-785643
 /hadoop/hdfs/branches/HDFS-265/src/test/hdfs:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/test/hdfs:820487
-/hadoop/hdfs/trunk/src/test/hdfs:1036213
+/hadoop/hdfs/trunk/src/test/hdfs:1036213,1036303

Modified: hadoop/hdfs/branches/branch-0.22/src/test/hdfs/org/apache/hadoop/hdfs/TestAbandonBlock.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/test/hdfs/org/apache/hadoop/hdfs/TestAbandonBlock.java?rev=1036641&r1=1036640&r2=1036641&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/test/hdfs/org/apache/hadoop/hdfs/TestAbandonBlock.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/test/hdfs/org/apache/hadoop/hdfs/TestAbandonBlock.java
Thu Nov 18 21:25:41 2010
@@ -25,47 +25,55 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.*;
 import org.apache.hadoop.hdfs.protocol.LocatedBlock;
 import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
-import org.apache.hadoop.hdfs.server.namenode.NameNode;
-import org.apache.hadoop.util.StringUtils;
 
-public class TestAbandonBlock extends junit.framework.TestCase {
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test abandoning blocks, which clients do on pipeline creation failure.
+ */
+public class TestAbandonBlock {
   public static final Log LOG = LogFactory.getLog(TestAbandonBlock.class);
   
   private static final Configuration CONF = new HdfsConfiguration();
   static final String FILE_NAME_PREFIX
       = "/" + TestAbandonBlock.class.getSimpleName() + "_"; 
+  private MiniDFSCluster cluster;
+  private FileSystem fs;
 
-  public void testAbandonBlock() throws IOException {
-    MiniDFSCluster cluster = new MiniDFSCluster.Builder(CONF).numDataNodes(2).build();
-    FileSystem fs = cluster.getFileSystem();
+  @Before
+  public void setUp() throws Exception {
+    cluster = new MiniDFSCluster.Builder(CONF).numDataNodes(2).build();
+    fs = cluster.getFileSystem();
+    cluster.waitActive();
+  }
 
+  @After
+  public void tearDown() throws Exception {
+    fs.close();
+    cluster.shutdown();
+  }
+
+  @Test
+  /** Abandon a block while creating a file */
+  public void testAbandonBlock() throws IOException {
     String src = FILE_NAME_PREFIX + "foo";
-    FSDataOutputStream fout = null;
-    try {
-      //start writing a a file but not close it
-      fout = fs.create(new Path(src), true, 4096, (short)1, 512L);
-      for(int i = 0; i < 1024; i++) {
-        fout.write(123);
-      }
-      fout.hflush();
-  
-      //try reading the block by someone
-      final DFSClient dfsclient = new DFSClient(NameNode.getAddress(CONF), CONF);
-      LocatedBlocks blocks = dfsclient.getNamenode().getBlockLocations(src, 0, 1);
-      LocatedBlock b = blocks.get(0); 
-      try {
-        dfsclient.getNamenode().abandonBlock(b.getBlock(), src, "someone");
-        //previous line should throw an exception.
-        assertTrue(false);
-      }
-      catch(IOException ioe) {
-        LOG.info("GREAT! " + StringUtils.stringifyException(ioe));
-      }
-    }
-    finally {
-      try{fout.close();} catch(Exception e) {}
-      try{fs.close();} catch(Exception e) {}
-      try{cluster.shutdown();} catch(Exception e) {}
+
+    // Start writing a file but do not close it
+    FSDataOutputStream fout = fs.create(new Path(src), true, 4096, (short)1, 512L);
+    for (int i = 0; i < 1024; i++) {
+      fout.write(123);
     }
+    fout.hflush();
+
+    // Now abandon the last block
+    DFSClient dfsclient = ((DistributedFileSystem)fs).getClient();
+    LocatedBlocks blocks = dfsclient.getNamenode().getBlockLocations(src, 0, 1);
+    LocatedBlock b = blocks.getLastLocatedBlock();
+    dfsclient.getNamenode().abandonBlock(b.getBlock(), src, dfsclient.clientName);
+
+    // And close the file
+    fout.close();
   }
 }

Propchange: hadoop/hdfs/branches/branch-0.22/src/webapps/datanode/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/webapps/datanode:776175-784663
 /hadoop/hdfs/branches/HDFS-265/src/webapps/datanode:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/webapps/datanode:820487
-/hadoop/hdfs/trunk/src/webapps/datanode:1036213
+/hadoop/hdfs/trunk/src/webapps/datanode:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/webapps/hdfs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/webapps/hdfs:776175-784663
 /hadoop/hdfs/branches/HDFS-265/src/webapps/hdfs:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/webapps/hdfs:820487
-/hadoop/hdfs/trunk/src/webapps/hdfs:1036213
+/hadoop/hdfs/trunk/src/webapps/hdfs:1036213,1036303

Propchange: hadoop/hdfs/branches/branch-0.22/src/webapps/secondary/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 18 21:25:41 2010
@@ -2,4 +2,4 @@
 /hadoop/core/trunk/src/webapps/secondary:776175-784663
 /hadoop/hdfs/branches/HDFS-265/src/webapps/secondary:796829-820463
 /hadoop/hdfs/branches/branch-0.21/src/webapps/secondary:820487
-/hadoop/hdfs/trunk/src/webapps/secondary:1036213
+/hadoop/hdfs/trunk/src/webapps/secondary:1036213,1036303



Mime
View raw message