hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r553080 - in /lucene/hadoop/trunk/src/contrib/hbase: ./ src/test/org/apache/hadoop/hbase/
Date Wed, 04 Jul 2007 04:48:19 GMT
Author: jimk
Date: Tue Jul  3 21:48:18 2007
New Revision: 553080

URL: http://svn.apache.org/viewvc?view=rev&rev=553080
Log:
HADOOP-1560 NPE in MiniHBaseCluster on Windows

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHRegion.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Tue Jul  3 21:48:18 2007
@@ -45,3 +45,4 @@
  26. HADOOP-1543 [hbase] Add HClient.tableExists
  27. HADOOP-1519 [hbase] map/reduce interface for HBase
  28. HADOOP-1523 Hung region server waiting on write locks 
+ 29. HADOOP-1560 NPE in MiniHBaseCluster on Windows

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/AbstractMergeTestBase.java
Tue Jul  3 21:48:18 2007
@@ -32,7 +32,7 @@
   protected HTableDescriptor desc;
   protected ImmutableBytesWritable value;
 
-  protected MiniDFSCluster dfsCluster;
+  protected MiniDFSCluster dfsCluster = null;
   protected FileSystem fs;
   protected Path dir;
 
@@ -104,6 +104,9 @@
       
     } catch(Throwable t) {
       t.printStackTrace();
+      if(dfsCluster != null) {
+        dfsCluster.shutdown();
+      }
       fail();
     }
   }

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/MiniHBaseCluster.java
Tue Jul  3 21:48:18 2007
@@ -37,8 +37,8 @@
   private MiniDFSCluster cluster;
   private FileSystem fs;
   private Path parentdir;
-  private HMaster master;
-  private Thread masterThread;
+  private HMaster master = null;
+  private Thread masterThread = null;
   List<HRegionServer> regionServers;
   List<Thread> regionThreads;
   private boolean deleteOnExit = true;
@@ -83,6 +83,8 @@
 
     this.conf = conf;
     this.cluster = dfsCluster;
+    this.regionServers = new ArrayList<HRegionServer>(nRegionNodes);
+    this.regionThreads = new ArrayList<Thread>(nRegionNodes);
     init(nRegionNodes);
   }
 
@@ -102,6 +104,8 @@
   throws IOException {
     this.conf = conf;
     this.deleteOnExit = deleteOnExit;
+    this.regionServers = new ArrayList<HRegionServer>(nRegionNodes);
+    this.regionThreads = new ArrayList<Thread>(nRegionNodes);
 
     if (miniHdfsFilesystem) {
       try {
@@ -167,8 +171,6 @@
 
   private void startRegionServers(final int nRegionNodes)
   throws IOException {
-    this.regionServers = new ArrayList<HRegionServer>(nRegionNodes);
-    this.regionThreads = new ArrayList<Thread>(nRegionNodes);    
     for(int i = 0; i < nRegionNodes; i++) {
       startRegionServer();
     }
@@ -239,7 +241,9 @@
     for(HRegionServer hsr: this.regionServers) {
       hsr.stop();
     }
-    master.shutdown();
+    if(master != null) {
+      master.shutdown();
+    }
     for(Thread t: this.regionThreads) {
       if (t.isAlive()) {
         try {
@@ -249,11 +253,13 @@
         }
       }
     }
-    try {
-      masterThread.join();
+    if (masterThread != null) {
+      try {
+        masterThread.join();
 
-    } catch(InterruptedException e) {
-      // continue
+      } catch(InterruptedException e) {
+        // continue
+      }
     }
     LOG.info("HBase Cluster shutdown complete");
 

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHRegion.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHRegion.java?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHRegion.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestHRegion.java
Tue Jul  3 21:48:18 2007
@@ -61,6 +61,9 @@
       cleanup();
       
     } catch(Exception e) {
+      if(cluster != null) {
+        cluster.shutdown();
+      }
       e.printStackTrace();
       fail();
     }
@@ -798,6 +801,7 @@
     // Shut down the mini cluster
 
     cluster.shutdown();
+    cluster = null;
 
     // Delete all the DFS files
 

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner.java?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestScanner.java
Tue Jul  3 21:48:18 2007
@@ -260,9 +260,6 @@
       throw e;
       
     } finally {
-      if(fs != null) {
-        fs.close();
-      }
       if(cluster != null) {
         cluster.shutdown();
       }

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java?view=diff&rev=553080&r1=553079&r2=553080
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestTableMapReduce.java
Tue Jul  3 21:48:18 2007
@@ -75,39 +75,46 @@
     desc.addFamily(new HColumnDescriptor(OUTPUT_COLUMN));
     
     dfsCluster = new MiniDFSCluster(conf, 1, true, (String[])null);
-    fs = dfsCluster.getFileSystem();
-    dir = new Path("/hbase");
-    fs.mkdirs(dir);
-
-    // create the root and meta regions and insert the data region into the meta
-
-    HRegion root = createNewHRegion(fs, dir, conf, HGlobals.rootTableDesc, 0L, null, null);
-    HRegion meta = createNewHRegion(fs, dir, conf, HGlobals.metaTableDesc, 1L, null, null);
-    HRegion.addRegionToMETA(root, meta);
-
-    HRegion region = createNewHRegion(fs, dir, conf, desc, rand.nextLong(), null, null);
-    HRegion.addRegionToMETA(meta, region);
-
-    // insert some data into the test table
-
-    for(int i = 0; i < values.length; i++) {
-      long lockid = region.startUpdate(new Text("row_"
-          + String.format("%1$05d", i)));
-
-      region.put(lockid, TEXT_INPUT_COLUMN, values[i]);
-      region.commit(lockid);
+    try {
+      fs = dfsCluster.getFileSystem();
+      dir = new Path("/hbase");
+      fs.mkdirs(dir);
+
+      // create the root and meta regions and insert the data region into the meta
+
+      HRegion root = createNewHRegion(fs, dir, conf, HGlobals.rootTableDesc, 0L, null, null);
+      HRegion meta = createNewHRegion(fs, dir, conf, HGlobals.metaTableDesc, 1L, null, null);
+      HRegion.addRegionToMETA(root, meta);
+
+      HRegion region = createNewHRegion(fs, dir, conf, desc, rand.nextLong(), null, null);
+      HRegion.addRegionToMETA(meta, region);
+
+      // insert some data into the test table
+
+      for(int i = 0; i < values.length; i++) {
+        long lockid = region.startUpdate(new Text("row_"
+            + String.format("%1$05d", i)));
+
+        region.put(lockid, TEXT_INPUT_COLUMN, values[i]);
+        region.commit(lockid);
+      }
+
+      region.close();
+      region.getLog().closeAndDelete();
+      meta.close();
+      meta.getLog().closeAndDelete();
+      root.close();
+      root.getLog().closeAndDelete();
+
+      // Start up HBase cluster
+
+      hCluster = new MiniHBaseCluster(conf, 1, dfsCluster);
+      
+    } catch (Exception e) {
+      if (dfsCluster != null) {
+        dfsCluster.shutdown();
+      }
     }
-
-    region.close();
-    region.getLog().closeAndDelete();
-    meta.close();
-    meta.getLog().closeAndDelete();
-    root.close();
-    root.getLog().closeAndDelete();
-  
-    // Start up HBase cluster
-    
-    hCluster = new MiniHBaseCluster(conf, 1, dfsCluster);
   }
 
   @Override



Mime
View raw message