From 03f409c50b352ad6544e10a964e477bac4c0ccfd Mon Sep 17 00:00:00 2001 From: chenheng Date: Tue, 15 Dec 2015 15:17:49 +0800 Subject: [PATCH] HBASE-14955 OOME: cannot create native thread is back --- .../test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java | 10 ++++++++++ .../hbase/mapreduce/TestImportTSVWithVisibilityLabels.java | 4 +--- .../hadoop/hbase/mapreduce/TestTableInputFormatScanBase.java | 4 +--- 3 files changed, 12 insertions(+), 6 deletions(-) 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 b0abf8d..44a27ba 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 @@ -161,6 +161,8 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { public static final String PRESPLIT_TEST_TABLE_KEY = "hbase.test.pre-split-table"; public static final boolean PRESPLIT_TEST_TABLE = true; + + public static final String USE_LOCAL_FILESYSTEM = "hbase.test.local.fileSystem"; /** * Set if we were passed a zkCluster. If so, we won't shutdown zk as * part of general shutdown. @@ -396,6 +398,11 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { return testPath; } + public void setJobWithoutMRCluster() throws IOException { + conf.set("hbase.fs.tmp.dir", getDataTestDirOnTestFS("hbase-staging").toString()); + conf.setBoolean(HBaseTestingUtility.USE_LOCAL_FILESYSTEM, true); + } + private void createSubDirAndSystemProperty( String propertyName, Path parent, String subDirName){ @@ -632,6 +639,9 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } FileSystem fs = this.dfsCluster.getFileSystem(); FSUtils.setFsDefault(this.conf, new Path(fs.getUri())); + if (this.conf.getBoolean(USE_LOCAL_FILESYSTEM, false)) { + FSUtils.setFsDefault(this.conf, new Path("file:///")); + } } public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], String hosts[]) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportTSVWithVisibilityLabels.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportTSVWithVisibilityLabels.java index 5020716..6426ec9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportTSVWithVisibilityLabels.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportTSVWithVisibilityLabels.java @@ -122,12 +122,11 @@ public class TestImportTSVWithVisibilityLabels implements Configurable { conf.set("hbase.coprocessor.region.classes", VisibilityController.class.getName()); conf.setClass(VisibilityUtils.VISIBILITY_LABEL_GENERATOR_CLASS, SimpleScanLabelGenerator.class, ScanLabelGenerator.class); + util.setJobWithoutMRCluster(); util.startMiniCluster(); // Wait for the labels table to become available util.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000); createLabels(); - Admin admin = new HBaseAdmin(util.getConfiguration()); - util.startMiniMapReduceCluster(); } private static void createLabels() throws IOException, InterruptedException { @@ -151,7 +150,6 @@ public class TestImportTSVWithVisibilityLabels implements Configurable { @AfterClass public static void releaseCluster() throws Exception { - util.shutdownMiniMapReduceCluster(); util.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScanBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScanBase.java index b41263c..8e451cd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScanBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatScanBase.java @@ -81,18 +81,16 @@ public abstract class TestTableInputFormatScanBase { // switch TIF to log at DEBUG level TEST_UTIL.enableDebug(TableInputFormat.class); TEST_UTIL.enableDebug(TableInputFormatBase.class); + TEST_UTIL.setJobWithoutMRCluster(); // start mini hbase cluster TEST_UTIL.startMiniCluster(3); // create and fill table table = TEST_UTIL.createMultiRegionTable(TableName.valueOf(TABLE_NAME), INPUT_FAMILY); TEST_UTIL.loadTable(table, INPUT_FAMILY, false); - // start MR cluster - TEST_UTIL.startMiniMapReduceCluster(); } @AfterClass public static void tearDownAfterClass() throws Exception { - TEST_UTIL.shutdownMiniMapReduceCluster(); TEST_UTIL.shutdownMiniCluster(); } -- 1.9.3 (Apple Git-50)