hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r558829 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/net/NetworkTopology.java src/test/org/apache/hadoop/dfs/TestFsck.java
Date Mon, 23 Jul 2007 18:46:30 GMT
Author: cutting
Date: Mon Jul 23 11:46:29 2007
New Revision: 558829

URL: http://svn.apache.org/viewvc?view=rev&rev=558829
Log:
HADOOP-1632.  Fix an IllegalArgumentException in fsck.  Contributed by Hairong.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/net/NetworkTopology.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestFsck.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=558829&r1=558828&r2=558829
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Jul 23 11:46:29 2007
@@ -401,6 +401,9 @@
 133. HADOOP-1638.  Fix contrib EC2 scripts to support NAT addressing.
      (Stu Hood via tomwhite) 
 
+134. HADOOP-1632.  Fix an IllegalArgumentException in fsck.
+     (Hairong Kuang via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/net/NetworkTopology.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/net/NetworkTopology.java?view=diff&rev=558829&r1=558828&r2=558829
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/net/NetworkTopology.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/net/NetworkTopology.java Mon Jul 23 11:46:29
2007
@@ -638,7 +638,7 @@
     }
     
     // put a random node at position 0 if it is not a local/local-rack node
-    if(tempIndex == 0) {
+    if(tempIndex == 0 && nodes.length != 0) {
       swap(nodes, 0, r.nextInt(nodes.length));
     }
   }

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestFsck.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestFsck.java?view=diff&rev=558829&r1=558828&r2=558829
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestFsck.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestFsck.java Mon Jul 23 11:46:29 2007
@@ -59,7 +59,24 @@
       String outStr = bStream.toString();
       assertTrue(-1 != outStr.indexOf("HEALTHY"));
       System.out.println(outStr);
-      util.cleanup(fs, "/srcdat");
+      cluster.shutdown();
+      
+      // restart the cluster; bring up namenode but not the data nodes
+      cluster = new MiniDFSCluster(conf, 0, false, null);
+      oldOut = System.out;
+      bStream = new ByteArrayOutputStream();
+      newOut = new PrintStream(bStream, true);
+      System.setOut(newOut);
+      assertEquals(0, new DFSck().doMain(conf, new String[] {"/"}));
+      System.setOut(oldOut);
+      outStr = bStream.toString();
+      // expect the result is corrupt
+      assertTrue(outStr.contains("CORRUPT"));
+      System.out.println(outStr);
+      
+      // bring up data nodes & cleanup cluster
+      cluster.startDataNodes(conf, 4, true, null, null);
+      util.cleanup(cluster.getFileSystem(), "/srcdat");
     } finally {
       if (cluster != null) { cluster.shutdown(); }
     }



Mime
View raw message