Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3EBAE18EC3 for ; Sun, 31 May 2015 00:37:41 +0000 (UTC) Received: (qmail 36193 invoked by uid 500); 31 May 2015 00:37:40 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 36144 invoked by uid 500); 31 May 2015 00:37:40 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 36131 invoked by uid 99); 31 May 2015 00:37:40 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 May 2015 00:37:40 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 91FCEE03CE; Sun, 31 May 2015 00:37:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: enis@apache.org To: commits@hbase.apache.org Message-Id: <0827a732948149789181e6894f70bc5d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-13809 TestRowTooBig should use HDFS directory for its region directory (Stephen Yuan Jiang) Date: Sun, 31 May 2015 00:37:40 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/branch-1.0 5e87486ff -> 0d10dcb40 HBASE-13809 TestRowTooBig should use HDFS directory for its region directory (Stephen Yuan Jiang) Conflicts: hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRowTooBig.java Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0d10dcb4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0d10dcb4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0d10dcb4 Branch: refs/heads/branch-1.0 Commit: 0d10dcb403f8ce42a56e81ecc9ce7c0ddaaf9612 Parents: 5e87486 Author: Enis Soztutar Authored: Sat May 30 17:19:38 2015 -0700 Committer: Enis Soztutar Committed: Sat May 30 17:37:28 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hbase/HBaseTestingUtility.java | 21 ++++++++ .../hbase/regionserver/TestRowTooBig.java | 57 +++++++++++--------- 2 files changed, 54 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/0d10dcb4/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index a731864..a95faf1 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -280,6 +280,15 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } /** + * Close the Region {@code r}. For use in tests. + */ + public static void closeRegion(final HRegion r) throws IOException { + if (r != null) { + r.close(); + } + } + + /** * Returns this classes's instance of {@link Configuration}. Be careful how * you use the returned Configuration since {@link HConnection} instances * can be shared. The Map of HConnections is keyed by the Configuration. If @@ -1714,6 +1723,18 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } /** + * Create an HRegion. Be sure to call {@link HBaseTestingUtility#closeRegion(Region)} + * when you're finished with it. + */ + public HRegion createHRegion( + final HRegionInfo info, + final Path rootDir, + final Configuration conf, + final HTableDescriptor htd) throws IOException { + return HRegion.createHRegion(info, rootDir, conf, htd); + } + + /** * Create an HRegion that writes to the local tmp dirs * @param desc * @param startKey http://git-wip-us.apache.org/repos/asf/hbase/blob/0d10dcb4/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 a307445..27ff254 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; @@ -38,6 +39,7 @@ import java.io.IOException; @Category(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())); @@ -46,6 +48,7 @@ public class TestRowTooBig { HTU.startMiniCluster(); HTU.getConfiguration().setLong(HConstants.TABLE_MAX_ROWSIZE_KEY, 10 * 1024 * 1024L); + rootRegionDir = HTU.getDataTestDirOnTestFS("TestRowTooBig"); } @AfterClass @@ -80,19 +83,22 @@ public class TestRowTooBig { final HRegionInfo hri = new HRegionInfo(htd.getTableName(), HConstants.EMPTY_END_ROW, HConstants.EMPTY_END_ROW); - HRegion region = HTU.createLocalHRegion(hri, htd); - - // Add 5 cells to memstore - for (int i = 0; i < 5 ; i++) { - Put put = new Put(row1); + HRegion region = HTU.createHRegion(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.flushcache(); + } - put.add(fam1, Bytes.toBytes("col_" + i ), new byte[5 * 1024 * 1024]); - region.put(put); - region.flushcache(); + Get get = new Get(row1); + region.get(get); + } finally { + HBaseTestingUtility.closeRegion(region); } - - Get get = new Get(row1); - region.get(get); } /** @@ -122,20 +128,23 @@ public class TestRowTooBig { final HRegionInfo hri = new HRegionInfo(htd.getTableName(), HConstants.EMPTY_END_ROW, HConstants.EMPTY_END_ROW); - HRegion 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]); + HRegion region = HTU.createHRegion(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.flushcache(); } - region.put(put); - region.flushcache(); - } - region.compactStores(true); + region.compactStores(true); - Get get = new Get(row1); - region.get(get); + Get get = new Get(row1); + region.get(get); + } finally { + HBaseTestingUtility.closeRegion(region); + } } }