Browse Source

HADOOP-2059 In tests, exceptions in min dfs shutdown should not fail test
(e.g. nightly #272)


git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@584919 13f79535-47bb-0310-9956-ffa450edef68

Michael Stack 18 years ago
parent
commit
01779ed935

+ 2 - 0
src/contrib/hbase/CHANGES.txt

@@ -9,6 +9,8 @@ Trunk (unreleased changes)
   OPTIMIZATIONS
 
   BUG FIXES
+   HADOOP-2059 In tests, exceptions in min dfs shutdown should not fail test
+               (e.g. nightly #272)
 
   IMPROVEMENTS
     HADOOP-2401 Add convenience put method that takes writable

+ 10 - 4
src/contrib/hbase/src/test/org/apache/hadoop/hbase/HBaseClusterTestCase.java

@@ -79,18 +79,24 @@ public abstract class HBaseClusterTestCase extends HBaseTestCase {
 
   @Override
   protected void setUp() throws Exception {
-    super.setUp();
     this.cluster =
       new MiniHBaseCluster(this.conf, this.regionServers, this.miniHdfs);
+    super.setUp();
   }
 
   @Override
   protected void tearDown() throws Exception {
     super.tearDown();
+    HConnectionManager.deleteConnection(conf);
     if (this.cluster != null) {
-      this.cluster.shutdown();
+      try {
+        this.cluster.shutdown();
+      } catch (Exception e) {
+        LOG.warn("Closing mini dfs", e);
+      }
     }
-    HConnectionManager.deleteConnection(conf);
+    // ReflectionUtils.printThreadInfo(new PrintWriter(System.out),
+    //  "Temporary end-of-test thread dump debugging HADOOP-2040: " + getName());
   }
 
   
@@ -129,4 +135,4 @@ public abstract class HBaseClusterTestCase extends HBaseTestCase {
       }
     }
   }
-}
+}

+ 12 - 4
src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHStoreFile.java

@@ -20,6 +20,7 @@
 package org.apache.hadoop.hbase;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -31,6 +32,7 @@ import org.apache.hadoop.io.MapFile;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.util.ReflectionUtils;
 
 /**
  * Test HStoreFile
@@ -45,19 +47,25 @@ public class TestHStoreFile extends HBaseTestCase {
   /** {@inheritDoc} */
   @Override
   public void setUp() throws Exception {
-    super.setUp();
     this.cluster = new MiniDFSCluster(this.conf, 2, true, (String[])null);
     this.fs = cluster.getFileSystem();
     this.dir = new Path(DIR, getName());
+    super.setUp();
   }
   
   /** {@inheritDoc} */
   @Override
   public void tearDown() throws Exception {
+    super.tearDown();
     if (this.cluster != null) {
-      this.cluster.shutdown();
+      try {
+        this.cluster.shutdown();
+      } catch (Exception e) {
+        LOG.warn("Closing down mini DFS", e);
+      }
     }
-    super.tearDown();
+    // ReflectionUtils.printThreadInfo(new PrintWriter(System.out),
+    //  "Temporary end-of-test thread dump debugging HADOOP-2040: " + getName());
   }
   
   private Path writeMapFile(final String name)
@@ -382,4 +390,4 @@ public class TestHStoreFile extends HBaseTestCase {
       this.fs.delete(p);
     }
   }
-}
+}

+ 1 - 1
src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestRegionServerExit.java

@@ -67,7 +67,7 @@ public class TestRegionServerExit extends HBaseClusterTestCase {
    * Test abort of region server.
    * @throws IOException
    */
-  public void REMOVEtestCleanExit() throws IOException {
+  public void testCleanExit() throws IOException {
     // When the META table can be opened, the region servers are running
     new HTable(this.conf, HConstants.META_TABLE_NAME);
     // Create table and add a row.