From dd2be628f5607e6b17b50ad8b9dd9a26adcc6ddd Mon Sep 17 00:00:00 2001 From: chenheng Date: Sat, 12 Dec 2015 11:28:14 +0800 Subject: [PATCH] HBASE-14915 Hanging test : org.apache.hadoop.hbase.mapreduce.TestImportExport --- .../apache/hadoop/hbase/HBaseTestingUtility.java | 4 ++- .../hadoop/hbase/mapreduce/TestImportExport.java | 34 +++++++++++----------- 2 files changed, 20 insertions(+), 18 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 6a7650a..0defb45 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 @@ -596,7 +596,9 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { return; } FileSystem fs = this.dfsCluster.getFileSystem(); - FSUtils.setFsDefault(this.conf, new Path(fs.getUri())); + if (this.conf.getBoolean("hbase.test.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/TestImportExport.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java index 2faac62..c672d53 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java @@ -65,6 +65,7 @@ import org.apache.hadoop.hbase.mapreduce.Import.KeyValueImporter; import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; import org.apache.hadoop.hbase.testclassification.LargeTests; +import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.LauncherSecurityManager; import org.apache.hadoop.hbase.wal.WAL; @@ -85,7 +86,7 @@ import org.mockito.stubbing.Answer; /** * Tests the table import and table export MR job functionality */ -@Category(LargeTests.class) +@Category(MediumTests.class) public class TestImportExport { private static final Log LOG = LogFactory.getLog(TestImportExport.class); private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); @@ -105,16 +106,15 @@ public class TestImportExport { @BeforeClass public static void beforeClass() throws Exception { // Up the handlers; this test needs more than usual. + UTIL.getConfiguration().setBoolean("hbase.test.local.fileSystem", true); UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10); UTIL.startMiniCluster(); - UTIL.startMiniMapReduceCluster(); FQ_OUTPUT_DIR = new Path(OUTPUT_DIR).makeQualified(FileSystem.get(UTIL.getConfiguration())).toString(); } @AfterClass public static void afterClass() throws Exception { - UTIL.shutdownMiniMapReduceCluster(); UTIL.shutdownMiniCluster(); } @@ -169,7 +169,7 @@ public class TestImportExport { * Test simple replication case with column mapping * @throws Exception */ - @Test + @Test (timeout=300000) public void testSimpleCase() throws Exception { String EXPORT_TABLE = "exportSimpleCase"; try (Table t = UTIL.createTable(TableName.valueOf(EXPORT_TABLE), FAMILYA, 3);) { @@ -217,7 +217,7 @@ public class TestImportExport { * * @throws Exception */ - @Test + @Test (timeout=300000) public void testMetaExport() throws Exception { String EXPORT_TABLE = TableName.META_TABLE_NAME.getNameAsString(); String[] args = new String[] { EXPORT_TABLE, FQ_OUTPUT_DIR, "1", "0", "0" }; @@ -228,7 +228,7 @@ public class TestImportExport { * Test import data from 0.94 exported file * @throws Exception */ - @Test + @Test (timeout=300000) public void testImport94Table() throws Exception { final String name = "exportedTableIn94Format"; URL url = TestImportExport.class.getResource(name); @@ -264,7 +264,7 @@ public class TestImportExport { /** * Test export scanner batching */ - @Test + @Test (timeout=300000) public void testExportScannerBatching() throws Exception { String BATCH_TABLE = "exportWithBatch"; try (Table t = UTIL.createTable(TableName.valueOf(BATCH_TABLE), FAMILYA, 1);) { @@ -288,7 +288,7 @@ public class TestImportExport { } } - @Test + @Test (timeout=300000) public void testWithDeletes() throws Exception { String IMPORT_TABLE = "importWithDeletes"; String EXPORT_TABLE = "exportWithDeletes"; @@ -351,7 +351,7 @@ public class TestImportExport { } } - @Test + @Test (timeout=300000) public void testWithMultipleDeleteFamilyMarkersOfSameRowSameFamily() throws Exception { String EXPORT_TABLE = "exportWithMultipleDeleteFamilyMarkersOfSameRowSameFamily"; HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(EXPORT_TABLE)); @@ -363,7 +363,7 @@ public class TestImportExport { Table exportT = UTIL.getConnection().getTable(desc.getTableName()); //Add first version of QUAL Put p = new Put(ROW1); - p.add(FAMILYA, QUAL, now, QUAL); + p.add(FAMILYA, QUAL, now, QUAL); exportT.put(p); //Add Delete family marker @@ -372,7 +372,7 @@ public class TestImportExport { //Add second version of QUAL p = new Put(ROW1); - p.add(FAMILYA, QUAL, now+5, "s".getBytes()); + p.add(FAMILYA, QUAL, now + 5, "s".getBytes()); exportT.put(p); //Add second Delete family marker @@ -426,7 +426,7 @@ public class TestImportExport { * Create a simple table, run an Export Job on it, Import with filtering on, verify counts, * attempt with invalid values. */ - @Test + @Test (timeout=300000) public void testWithFilter() throws Exception { // Create simple table to export String EXPORT_TABLE = "exportSimpleCase_ImportWithFilter"; @@ -508,7 +508,7 @@ public class TestImportExport { /** * test main method. Import should print help and call System.exit */ - @Test + @Test (timeout=300000) public void testImportMain() throws Exception { PrintStream oldPrintStream = System.err; SecurityManager SECURITY_MANAGER = System.getSecurityManager(); @@ -537,7 +537,7 @@ public class TestImportExport { /** * test main method. Export should print help and call System.exit */ - @Test + @Test (timeout=300000) public void testExportMain() throws Exception { PrintStream oldPrintStream = System.err; SecurityManager SECURITY_MANAGER = System.getSecurityManager(); @@ -572,7 +572,7 @@ public class TestImportExport { * Test map method of Importer */ @SuppressWarnings({ "unchecked", "rawtypes" }) - @Test + @Test (timeout=300000) public void testKeyValueImporter() throws Exception { KeyValueImporter importer = new KeyValueImporter(); Configuration configuration = new Configuration(); @@ -607,7 +607,7 @@ public class TestImportExport { * Test addFilterAndArguments method of Import This method set couple * parameters into Configuration */ - @Test + @Test (timeout=300000) public void testAddFilterAndArguments() throws IOException { Configuration configuration = new Configuration(); @@ -621,7 +621,7 @@ public class TestImportExport { assertEquals("param1,param2", configuration.get(Import.FILTER_ARGS_CONF_KEY)); } - @Test + @Test (timeout=300000) public void testDurability() throws IOException, InterruptedException, ClassNotFoundException { // Create an export table. String exportTableName = "exporttestDurability"; -- 2.5.4 (Apple Git-61)