hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1348147 - in /hbase/branches/0.90: CHANGES.txt src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java
Date Fri, 08 Jun 2012 16:40:52 GMT
Author: jxiang
Date: Fri Jun  8 16:40:52 2012
New Revision: 1348147

URL: http://svn.apache.org/viewvc?rev=1348147&view=rev
Log:
HBASE-6190 TestPriorityCompactionQueue throws NPE

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1348147&r1=1348146&r2=1348147&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Fri Jun  8 16:40:52 2012
@@ -2,6 +2,7 @@ HBase Change Log
 
 Release 0.90.7 - Unreleased
   BUG FIXES
+   HBASE-6190  TestPriorityCompactionQueue throws NPE 
    HBASE-5568  Multi concurrent flushcache() for one region could cause data loss (Chunhui)
    HBASE-5482  In 0.90, balancer algo leading to same region balanced twice and picking 
                same region with Src and Destination as same RS. (Ram)

Modified: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java?rev=1348147&r1=1348146&r2=1348147&view=diff
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java
(original)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/regionserver/TestPriorityCompactionQueue.java
Fri Jun  8 16:40:52 2012
@@ -19,8 +19,19 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
+import java.io.IOException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.regionserver.wal.HLog;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -41,14 +52,27 @@ public class TestPriorityCompactionQueue
 
   }
 
-  class DummyHRegion extends HRegion {
+  static class DummyHRegion extends HRegion {
     String name;
 
-    DummyHRegion(String name) {
-      super();
+    DummyHRegion(Configuration conf, String name,
+        Path tableDir, FileSystem fs, HRegionInfo regionInfo) {
+      super(tableDir, null, fs, conf, regionInfo, null);
       this.name = name;
     }
 
+    static DummyHRegion createRegion(
+        Configuration conf, String name) throws IOException {
+      byte[] startKey = Bytes.toBytes(name + "-A-startKey");
+      byte[] endKey = Bytes.toBytes(name + "-B-endKey");
+      HTableDescriptor htd = new HTableDescriptor(name);
+      HRegionInfo regionInfo = new HRegionInfo(htd, startKey, endKey);
+      Path rootDir = new Path(conf.get(HConstants.HBASE_DIR));
+      FileSystem fs = rootDir.getFileSystem(conf);
+      Path p = new Path(rootDir, htd.getNameAsString());
+      return new DummyHRegion(conf, name, p, fs, regionInfo);
+    }
+
     public int hashCode() {
       return name.hashCode();
     }
@@ -93,14 +117,16 @@ public class TestPriorityCompactionQueue
   // ////////////////////////////////////////////////////////////////////////////
 
   /** tests general functionality of the compaction queue */
-  @Test public void testPriorityQueue() throws InterruptedException {
+  @Test public void testPriorityQueue()
+      throws IOException, InterruptedException {
     PriorityCompactionQueue pq = new PriorityCompactionQueue();
 
-    HRegion r1 = new DummyHRegion("r1");
-    HRegion r2 = new DummyHRegion("r2");
-    HRegion r3 = new DummyHRegion("r3");
-    HRegion r4 = new DummyHRegion("r4");
-    HRegion r5 = new DummyHRegion("r5");
+    Configuration conf = HBaseConfiguration.create();
+    HRegion r1 = DummyHRegion.createRegion(conf, "r1");
+    HRegion r2 = DummyHRegion.createRegion(conf, "r2");
+    HRegion r3 = DummyHRegion.createRegion(conf, "r3");
+    HRegion r4 = DummyHRegion.createRegion(conf, "r4");
+    HRegion r5 = DummyHRegion.createRegion(conf, "r5");
 
     // test 1
     // check fifo w/priority



Mime
View raw message