You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2015/05/31 02:13:21 UTC

hbase git commit: HBASE-13809 TestRowTooBig should use HDFS directory for its region directory (Stephen Yuan Jiang)

Repository: hbase
Updated Branches:
  refs/heads/master ae803d72f -> 0e6102a68


HBASE-13809 TestRowTooBig should use HDFS directory for its region directory (Stephen Yuan Jiang)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0e6102a6
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0e6102a6
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0e6102a6

Branch: refs/heads/master
Commit: 0e6102a68cc95f0240fa72a5f86866c07b8744b7
Parents: ae803d7
Author: Enis Soztutar <en...@apache.org>
Authored: Sat May 30 17:13:05 2015 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Sat May 30 17:13:05 2015 -0700

----------------------------------------------------------------------
 .../hbase/regionserver/TestRowTooBig.java       | 59 ++++++++++++--------
 1 file changed, 35 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0e6102a6/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java
index 5f7a7d1..ab12195 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java
@@ -19,6 +19,7 @@
 
 package org.apache.hadoop.hbase.regionserver;
 
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Put;
@@ -40,6 +41,7 @@ import java.io.IOException;
 @Category({RegionServerTests.class, MediumTests.class})
 public class TestRowTooBig {
   private final static HBaseTestingUtility HTU = HBaseTestingUtility.createLocalHTU();
+  private static Path rootRegionDir;
   private static final HTableDescriptor TEST_HTD =
     new HTableDescriptor(TableName.valueOf(TestRowTooBig.class.getSimpleName()));
 
@@ -48,6 +50,7 @@ public class TestRowTooBig {
     HTU.startMiniCluster();
     HTU.getConfiguration().setLong(HConstants.TABLE_MAX_ROWSIZE_KEY,
       10 * 1024 * 1024L);
+    rootRegionDir = HTU.getDataTestDirOnTestFS("TestRowTooBig");
   }
 
   @AfterClass
@@ -82,19 +85,23 @@ public class TestRowTooBig {
     final HRegionInfo hri =
       new HRegionInfo(htd.getTableName(), HConstants.EMPTY_END_ROW,
         HConstants.EMPTY_END_ROW);
-    Region region = HTU.createLocalHRegion(hri,  htd);
-
-    // Add 5 cells to memstore
-    for (int i = 0; i < 5 ; i++) {
-      Put put = new Put(row1);
+    Region region =
+        HBaseTestingUtility.createRegionAndWAL(hri, rootRegionDir, HTU.getConfiguration(), htd);
+    try {
+      // Add 5 cells to memstore
+      for (int i = 0; i < 5 ; i++) {
+        Put put = new Put(row1);
+
+        put.add(fam1, Bytes.toBytes("col_" + i ), new byte[5 * 1024 * 1024]);
+        region.put(put);
+        region.flush(true);
+      }
 
-      put.add(fam1, Bytes.toBytes("col_" + i ), new byte[5 * 1024 * 1024]);
-      region.put(put);
-      region.flush(true);
+      Get get = new Get(row1);
+      region.get(get);
+    } finally {
+      HBaseTestingUtility.closeRegionAndWAL(region);
     }
-
-    Get get = new Get(row1);
-    region.get(get);
   }
 
   /**
@@ -124,20 +131,24 @@ public class TestRowTooBig {
     final HRegionInfo hri =
       new HRegionInfo(htd.getTableName(), HConstants.EMPTY_END_ROW,
         HConstants.EMPTY_END_ROW);
-    Region region = HTU.createLocalHRegion(hri,  htd);
-
-    // Add to memstore
-    for (int i = 0; i < 10; i++) {
-      Put put = new Put(row1);
-      for (int j = 0; j < 10 * 10000; j++) {
-        put.add(fam1, Bytes.toBytes("col_" + i + "_" + j), new byte[10]);
+    Region region =
+        HBaseTestingUtility.createRegionAndWAL(hri, rootRegionDir, HTU.getConfiguration(), htd);
+    try {
+      // Add to memstore
+      for (int i = 0; i < 10; i++) {
+        Put put = new Put(row1);
+        for (int j = 0; j < 10 * 10000; j++) {
+          put.add(fam1, Bytes.toBytes("col_" + i + "_" + j), new byte[10]);
+        }
+        region.put(put);
+        region.flush(true);
       }
-      region.put(put);
-      region.flush(true);
-    }
-    region.compact(true);
+      region.compact(true);
 
-    Get get = new Get(row1);
-    region.get(get);
+      Get get = new Get(row1);
+      region.get(get);
+    } finally {
+      HBaseTestingUtility.closeRegionAndWAL(region);
+    }
   }
 }