You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ni...@apache.org on 2007/09/25 20:06:41 UTC

svn commit: r579334 - in /lucene/hadoop/trunk: CHANGES.txt src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java

Author: nigel
Date: Tue Sep 25 11:06:40 2007
New Revision: 579334

URL: http://svn.apache.org/viewvc?rev=579334&view=rev
Log:
HADOOP-1940.  TestDFSUpgradeFromImage must shut down its MiniDFSCluster.  Contributed by Chris.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=579334&r1=579333&r2=579334&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Sep 25 11:06:40 2007
@@ -188,6 +188,9 @@
     HADOOP-1925.  Make pipes' autoconf script look for libsocket and libnsl, so
     that it can compile under Solaris. (omalley)
 
+    HADOOP-1940.  TestDFSUpgradeFromImage must shut down its MiniDFSCluster.
+    (Chris Douglas via nigel)
+
   IMPROVEMENTS
 
     HADOOP-1921. Save the configuration of completed/failed jobs and make them

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java?rev=579334&r1=579333&r2=579334&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSUpgradeFromImage.java Tue Sep 25 11:06:40 2007
@@ -175,23 +175,27 @@
   }
   
   public void testUpgradeFromImage() throws IOException {
-    
-    Configuration conf = new Configuration();
-    MiniDFSCluster cluster = new MiniDFSCluster(0, conf, numDataNodes, false,
-                                                true, StartupOption.UPGRADE,
-                                                null);
-    cluster.waitActive();
-    DFSClient dfsClient = new DFSClient(new InetSocketAddress("localhost", 
-                                                  cluster.getNameNodePort()),
-                                        conf);
-    //Safemode will be off only after upgrade is complete. Wait for it.
-    while ( dfsClient.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_GET) ) {
-      LOG.info("Waiting for SafeMode to be OFF.");
-      try {
-        Thread.sleep(1000);
-      } catch (InterruptedException ignored) {}
-    }
+    MiniDFSCluster cluster = null;
+    try {
+      Configuration conf = new Configuration();
+      cluster = new MiniDFSCluster(0, conf, numDataNodes, false,
+                                                  true, StartupOption.UPGRADE,
+                                                  null);
+      cluster.waitActive();
+      DFSClient dfsClient = new DFSClient(new InetSocketAddress("localhost",
+                                                    cluster.getNameNodePort()),
+                                          conf);
+      //Safemode will be off only after upgrade is complete. Wait for it.
+      while ( dfsClient.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_GET) ) {
+        LOG.info("Waiting for SafeMode to be OFF.");
+        try {
+          Thread.sleep(1000);
+        } catch (InterruptedException ignored) {}
+      }
 
-    verifyFileSystem(dfsClient);
+      verifyFileSystem(dfsClient);
+    } finally {
+      if (cluster != null) { cluster.shutdown(); }
+    }
   }
 }