From 73d80bb416dba867bab2f7c21333d443cf090883 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Fri, 28 Apr 2017 13:41:58 +0800 Subject: [PATCH] HBASE-17970 Set yarn.app.mapreduce.am.staging-dir when starting MiniMRCluster Signed-off-by: Sean Busbey --- .../apache/hadoop/hbase/HBaseTestingUtility.java | 4 +++- .../hadoop/hbase/snapshot/TestExportSnapshot.java | 13 ++++--------- .../hbase/snapshot/TestExportSnapshotNoCluster.java | 5 +---- .../hbase/snapshot/TestMobExportSnapshot.java | 9 +-------- .../hbase/snapshot/TestMobSecureExportSnapshot.java | 3 +-- .../hbase/snapshot/TestSecureExportSnapshot.java | 3 +-- 6 files changed, 11 insertions(+), 26 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 e0edfa33e38..afc070d32f8 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 @@ -91,11 +91,11 @@ import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.RegionStates; import org.apache.hadoop.hbase.master.ServerManager; import org.apache.hadoop.hbase.regionserver.BloomType; +import org.apache.hadoop.hbase.regionserver.ChunkCreator; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.HStore; import org.apache.hadoop.hbase.regionserver.InternalScanner; -import org.apache.hadoop.hbase.regionserver.ChunkCreator; import org.apache.hadoop.hbase.regionserver.MemStoreLABImpl; import org.apache.hadoop.hbase.regionserver.Region; import org.apache.hadoop.hbase.regionserver.RegionScanner; @@ -723,6 +723,8 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { conf.set("mapreduce.jobtracker.staging.root.dir", new Path(root, "mapreduce-jobtracker-staging-root-dir").toString()); conf.set("mapreduce.job.working.dir", new Path(root, "mapred-working-dir").toString()); + conf.set("yarn.app.mapreduce.am.staging-dir", + new Path(root, "mapreduce-am-staging-root-dir").toString()); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java index 52412d93188..cc055a58538 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java @@ -20,8 +20,8 @@ package org.apache.hadoop.hbase.snapshot; import static org.apache.hadoop.util.ToolRunner.run; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.net.URI; @@ -43,9 +43,9 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; -import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.SnapshotDescription; import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotRegionManifest; +import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.VerySlowMapReduceTests; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.FSUtils; @@ -96,19 +96,14 @@ public class TestExportSnapshot { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBaseConf(TEST_UTIL.getConfiguration()); - // Setup separate test-data directory for MR cluster and set corresponding configurations. - // Otherwise, different test classes running MR cluster can step on each other. - TEST_UTIL.getDataTestDir(); - TEST_UTIL.startMiniZKCluster(); + TEST_UTIL.startMiniCluster(1, 3); TEST_UTIL.startMiniMapReduceCluster(); - TEST_UTIL.startMiniHBaseCluster(1, 3); } @AfterClass public static void tearDownAfterClass() throws Exception { - TEST_UTIL.shutdownMiniHBaseCluster(); TEST_UTIL.shutdownMiniMapReduceCluster(); - TEST_UTIL.shutdownMiniZKCluster(); + TEST_UTIL.shutdownMiniCluster(); } /** diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotNoCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotNoCluster.java index cd5ff6c9071..00778502349 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotNoCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshotNoCluster.java @@ -18,9 +18,6 @@ package org.apache.hadoop.hbase.snapshot; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -32,8 +29,8 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock; -import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.MapReduceTests; +import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.Bytes; import org.junit.BeforeClass; import org.junit.Rule; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java index 55686b1be0c..a4db92b2d92 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java @@ -19,8 +19,6 @@ package org.apache.hadoop.hbase.snapshot; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.mob.MobConstants; @@ -35,7 +33,6 @@ import org.junit.experimental.categories.Category; */ @Category({VerySlowRegionServerTests.class, LargeTests.class}) public class TestMobExportSnapshot extends TestExportSnapshot { - private final Log LOG = LogFactory.getLog(getClass()); public static void setUpBaseConf(Configuration conf) { TestExportSnapshot.setUpBaseConf(conf); @@ -45,12 +42,8 @@ public class TestMobExportSnapshot extends TestExportSnapshot { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBaseConf(TEST_UTIL.getConfiguration()); - // Setup separate test-data directory for MR cluster and set corresponding configurations. - // Otherwise, different test classes running MR cluster can step on each other. - TEST_UTIL.getDataTestDir(); - TEST_UTIL.startMiniZKCluster(); + TEST_UTIL.startMiniCluster(1, 3); TEST_UTIL.startMiniMapReduceCluster(); - TEST_UTIL.startMiniHBaseCluster(1, 3); } @Override diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java index c0f31d5cba2..f6fb8525f86 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java @@ -48,9 +48,8 @@ public class TestMobSecureExportSnapshot extends TestMobExportSnapshot { // setup configuration SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniZKCluster(); + TEST_UTIL.startMiniCluster(1, 3); TEST_UTIL.startMiniMapReduceCluster(); - TEST_UTIL.startMiniHBaseCluster(1, 3); // Wait for the ACL table to become available TEST_UTIL.waitTableEnabled(AccessControlLists.ACL_TABLE_NAME); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java index 4d35b716918..649a1af8ac3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java @@ -53,9 +53,8 @@ public class TestSecureExportSnapshot extends TestExportSnapshot { // setup configuration SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniZKCluster(); + TEST_UTIL.startMiniCluster(1, 3); TEST_UTIL.startMiniMapReduceCluster(); - TEST_UTIL.startMiniHBaseCluster(1, 3); // Wait for the ACL table to become available TEST_UTIL.waitTableEnabled(AccessControlLists.ACL_TABLE_NAME);