diff --git a/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestRefreshHFilesEndpoint.java b/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestRefreshHFilesEndpoint.java index b28db1196ea..d94210496f3 100644 --- a/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestRefreshHFilesEndpoint.java +++ b/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/TestRefreshHFilesEndpoint.java @@ -65,7 +65,6 @@ public class TestRefreshHFilesEndpoint { private static final Logger LOG = LoggerFactory.getLogger(TestRefreshHFilesEndpoint.class); private static final HBaseTestingUtility HTU = new HBaseTestingUtility(); - private static final int NUM_MASTER = 1; private static final int NUM_RS = 2; private static final TableName TABLE_NAME = TableName.valueOf("testRefreshRegionHFilesEP"); private static final byte[] FAMILY = Bytes.toBytes("family"); @@ -84,7 +83,7 @@ public class TestRefreshHFilesEndpoint { CONF.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2); CONF.setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, RefreshHFilesEndpoint.class.getName()); - cluster = HTU.startMiniCluster(NUM_MASTER, NUM_RS); + cluster = HTU.startMiniCluster(NUM_RS); // Create table table = HTU.createTable(TABLE_NAME, FAMILY, SPLIT_KEY); diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java index 385ad3e6b23..744c3564101 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java @@ -29,6 +29,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Result; @@ -57,7 +58,10 @@ public abstract class TableSnapshotInputFormatTestBase { public void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); - UTIL.startMiniCluster(NUM_REGION_SERVERS, true); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(NUM_REGION_SERVERS).numDataNodes(NUM_REGION_SERVERS) + .createRootDir(true).build(); + UTIL.startMiniCluster(option); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); fs = rootDir.getFileSystem(UTIL.getConfiguration()); } diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java index d9c0ae9b532..679b2318cd5 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHFileOutputFormat2.java @@ -59,6 +59,7 @@ import org.apache.hadoop.hbase.HadoopShims; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.PerformanceEvaluation; import org.apache.hadoop.hbase.PrivateCellUtil; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; @@ -607,7 +608,9 @@ public class TestHFileOutputFormat2 { for (int i = 0; i < hostCount; ++i) { hostnames[i] = "datanode_" + i; } - util.startMiniCluster(1, hostCount, hostnames); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(hostCount).dataNodeHosts(hostnames).build(); + util.startMiniCluster(option); Map allTables = new HashMap<>(tableStr.size()); List tableInfo = new ArrayList<>(tableStr.size()); diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java index 6dca6e74457..c988854b62c 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java @@ -99,7 +99,7 @@ public class TestExportSnapshot { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBaseConf(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniCluster(1, 3); + TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniMapReduceCluster(); } diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java index ed605b90be5..9bffd081f2d 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobExportSnapshot.java @@ -47,7 +47,7 @@ public class TestMobExportSnapshot extends TestExportSnapshot { @BeforeClass public static void setUpBeforeClass() throws Exception { setUpBaseConf(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniCluster(1, 3); + TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniMapReduceCluster(); } diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java index b4e0afd2848..1a5756bd493 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestMobSecureExportSnapshot.java @@ -53,7 +53,7 @@ public class TestMobSecureExportSnapshot extends TestMobExportSnapshot { // setup configuration SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniCluster(1, 3); + TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniMapReduceCluster(); // Wait for the ACL table to become available diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java index 8804b83fb2a..77da0d527fc 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestSecureExportSnapshot.java @@ -52,7 +52,7 @@ public class TestSecureExportSnapshot extends TestExportSnapshot { // setup configuration SecureTestUtil.enableSecurity(TEST_UTIL.getConfiguration()); - TEST_UTIL.startMiniCluster(1, 3); + TEST_UTIL.startMiniCluster(3); TEST_UTIL.startMiniMapReduceCluster(); // Wait for the ACL table to become available diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java index 43d586f812b..5e4c2d7d159 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java @@ -89,7 +89,7 @@ public class TestStatusResource { @BeforeClass public static void setUpBeforeClass() throws Exception { conf = TEST_UTIL.getConfiguration(); - TEST_UTIL.startMiniCluster(1, 1); + TEST_UTIL.startMiniCluster(); TEST_UTIL.createTable(TableName.valueOf("TestStatusResource"), Bytes.toBytes("D")); TEST_UTIL.createTable(TableName.valueOf("TestStatusResource2"), Bytes.toBytes("D")); REST_TEST_UTIL.startServletContainer(conf); diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java index d6df9109fdb..1d5881e2e43 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsOfflineMode.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Admin; @@ -83,7 +84,9 @@ public class TestRSGroupsOfflineMode { TEST_UTIL.getConfiguration().set( ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, "1"); - TEST_UTIL.startMiniCluster(2, 3); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(3).numDataNodes(3).build(); + TEST_UTIL.startMiniCluster(option); cluster = TEST_UTIL.getHBaseCluster(); master = ((MiniHBaseCluster)cluster).getMaster(); master.balanceSwitch(false); 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 b938d2834f2..732f6e6debf 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 @@ -765,197 +765,266 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility { } } + /** + * Start up a minicluster of hbase, dfs, and zookeeper where WAL's walDir is created separately. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param createWALDir Whether to create a new WAL directory. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(boolean createWALDir) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .createWALDir(createWALDir).build(); + return startMiniCluster(option); + } /** * Start up a minicluster of hbase, dfs, and zookeeper. - * @throws Exception - * @return Mini hbase cluster instance created. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param createRootDir Whether to create a new root or data directory path. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numSlaves, boolean createRootDir) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(numSlaves).numDataNodes(numSlaves).createRootDir(createRootDir).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param createRootDir Whether to create a new root or data directory path. + * @param createWALDir Whether to create a new WAL directory. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numSlaves, boolean createRootDir, + boolean createWALDir) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(numSlaves).numDataNodes(numSlaves).createRootDir(createRootDir) + .createWALDir(createWALDir).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param createRootDir Whether to create a new root or data directory path. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numSlaves, boolean createRootDir) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numSlaves).createRootDir(createRootDir) + .numDataNodes(numSlaves).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numSlaves) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numSlaves).numDataNodes(numSlaves).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param dataNodeHosts The hostnames of DataNodes to run on. If not null, its size will overwrite + * HDFS data node number. + * @param createRootDir Whether to create a new root or data directory path. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numSlaves, String[] dataNodeHosts, + boolean createRootDir) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numSlaves).createRootDir(createRootDir) + .numDataNodes(numSlaves).dataNodeHosts(dataNodeHosts).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param dataNodeHosts The hostnames of DataNodes to run on. If not null, its size will overwrite + * HDFS data node number. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numSlaves, String[] dataNodeHosts) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numSlaves) + .numDataNodes(numSlaves).dataNodeHosts(dataNodeHosts).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @param numDataNodes Number of datanodes. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numRegionServers, int numDataNodes) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numRegionServers).numDataNodes(numDataNodes) + .build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numSlaves Slave node number, for both HBase region server and HDFS data node. + * @param dataNodeHosts The hostnames of DataNodes to run on. If not null, its size will overwrite + * HDFS data node number. + * @param masterClass The class to use as HMaster, or null for default. + * @param rsClass The class to use as HRegionServer, or null for default. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numSlaves, String[] dataNodeHosts, + Class masterClass, + Class rsClass) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).masterClass(masterClass) + .numRegionServers(numSlaves).rsClass(rsClass) + .numDataNodes(numSlaves).dataNodeHosts(dataNodeHosts) + .build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @param numDataNodes Number of datanodes. + * @param dataNodeHosts The hostnames of DataNodes to run on. If not null, its size will overwrite + * HDFS data node number. + * @param masterClass The class to use as HMaster, or null for default. + * @param rsClass The class to use as HRegionServer, or null for default. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numRegionServers, int numDataNodes, + String[] dataNodeHosts, Class masterClass, + Class rsClass) + throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).masterClass(masterClass) + .numRegionServers(numRegionServers).rsClass(rsClass) + .numDataNodes(numDataNodes).dataNodeHosts(dataNodeHosts) + .build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs, and zookeeper. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @param numDataNodes Number of datanodes. + * @param dataNodeHosts The hostnames of DataNodes to run on. If not null, its size will overwrite + * HDFS data node number. + * @param masterClass The class to use as HMaster, or null for default. + * @param rsClass The class to use as HRegionServer, or null for default. + * @param createRootDir Whether to create a new root or data directory path. + * @param createWALDir Whether to create a new WAL directory. + * @return The mini HBase cluster created. + * @see #shutdownMiniCluster() + * @deprecated Use {@link #startMiniCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniCluster(int numMasters, int numRegionServers, int numDataNodes, + String[] dataNodeHosts, Class masterClass, + Class rsClass, boolean createRootDir, + boolean createWALDir) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).masterClass(masterClass) + .numRegionServers(numRegionServers).rsClass(rsClass) + .numDataNodes(numDataNodes).dataNodeHosts(dataNodeHosts) + .createRootDir(createRootDir).createWALDir(createWALDir) + .build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs and zookeeper clusters with given slave node number. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numSlaves slave node number, for both HBase region server and HDFS data node. + * @see #startMiniCluster(StartMiniClusterOption option) + * @see #shutdownMiniDFSCluster() + */ + public MiniHBaseCluster startMiniCluster(int numSlaves) throws Exception { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(numSlaves).numDataNodes(numSlaves).build(); + return startMiniCluster(option); + } + + /** + * Start up a minicluster of hbase, dfs and zookeeper all using default options. + * Option default value can be found in {@link StartMiniClusterOption.Builder}. + * @see #startMiniCluster(StartMiniClusterOption option) * @see #shutdownMiniDFSCluster() */ public MiniHBaseCluster startMiniCluster() throws Exception { - return startMiniCluster(1, 1); + return startMiniCluster(StartMiniClusterOption.builder().build()); } /** - * Start up a minicluster of hbase, dfs, and zookeeper where WAL's walDir is created separately. - * @throws Exception - * @return Mini hbase cluster instance created. + * Start up a mini cluster of hbase, optionally dfs and zookeeper if needed. + * It modifies Configuration. It homes the cluster data directory under a random + * subdirectory in a directory under System property test.build.data, to be cleaned up on exit. * @see #shutdownMiniDFSCluster() */ - public MiniHBaseCluster startMiniCluster(boolean withWALDir) throws Exception { - return startMiniCluster(1, 1, 1, null, null, null, false, withWALDir); - } - - /** - * Start up a minicluster of hbase, dfs, and zookeeper. - * Set the create flag to create root or data directory path or not - * (will overwrite if dir already exists) - * @throws Exception - * @return Mini hbase cluster instance created. - * @see #shutdownMiniDFSCluster() - */ - public MiniHBaseCluster startMiniCluster(final int numSlaves, boolean create) - throws Exception { - return startMiniCluster(1, numSlaves, create); - } - - /** - * Start up a minicluster of hbase, optionally dfs, and zookeeper. - * Modifies Configuration. Homes the cluster data directory under a random - * subdirectory in a directory under System property test.build.data. - * Directory is cleaned up on exit. - * @param numSlaves Number of slaves to start up. We'll start this many - * datanodes and regionservers. If numSlaves is > 1, then make sure - * hbase.regionserver.info.port is -1 (i.e. no ui per regionserver) otherwise - * bind errors. - * @throws Exception - * @see #shutdownMiniCluster() - * @return Mini hbase cluster instance created. - */ - public MiniHBaseCluster startMiniCluster(final int numSlaves) - throws Exception { - return startMiniCluster(1, numSlaves, false); - } - - public MiniHBaseCluster startMiniCluster(final int numSlaves, boolean create, boolean withWALDir) - throws Exception { - return startMiniCluster(1, numSlaves, numSlaves, null, null, null, create, withWALDir); - } - - /** - * Start minicluster. Whether to create a new root or data dir path even if such a path - * has been created earlier is decided based on flag create - * @throws Exception - * @see #shutdownMiniCluster() - * @return Mini hbase cluster instance created. - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, boolean create) - throws Exception { - return startMiniCluster(numMasters, numSlaves, null, create); - } - - /** - * start minicluster - * @throws Exception - * @see #shutdownMiniCluster() - * @return Mini hbase cluster instance created. - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves) - throws Exception { - return startMiniCluster(numMasters, numSlaves, null, false); - } - - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, final String[] dataNodeHosts, boolean create) - throws Exception { - return startMiniCluster(numMasters, numSlaves, numSlaves, dataNodeHosts, - null, null, create, false); - } - - /** - * Start up a minicluster of hbase, optionally dfs, and zookeeper. - * Modifies Configuration. Homes the cluster data directory under a random - * subdirectory in a directory under System property test.build.data. - * Directory is cleaned up on exit. - * @param numMasters Number of masters to start up. We'll start this many - * hbase masters. If numMasters > 1, you can find the active/primary master - * with {@link MiniHBaseCluster#getMaster()}. - * @param numSlaves Number of slaves to start up. We'll start this many - * regionservers. If dataNodeHosts == null, this also indicates the number of - * datanodes to start. If dataNodeHosts != null, the number of datanodes is - * based on dataNodeHosts.length. - * If numSlaves is > 1, then make sure - * hbase.regionserver.info.port is -1 (i.e. no ui per regionserver) otherwise - * bind errors. - * @param dataNodeHosts hostnames DNs to run on. - * This is useful if you want to run datanode on distinct hosts for things - * like HDFS block location verification. - * If you start MiniDFSCluster without host names, - * all instances of the datanodes will have the same host name. - * @throws Exception - * @see #shutdownMiniCluster() - * @return Mini hbase cluster instance created. - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, final String[] dataNodeHosts) throws Exception { - return startMiniCluster(numMasters, numSlaves, numSlaves, dataNodeHosts, - null, null); - } - - /** - * Same as {@link #startMiniCluster(int, int)}, but with custom number of datanodes. - * @param numDataNodes Number of data nodes. - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, final int numDataNodes) throws Exception { - return startMiniCluster(numMasters, numSlaves, numDataNodes, null, null, null); - } - - /** - * Start up a minicluster of hbase, optionally dfs, and zookeeper. - * Modifies Configuration. Homes the cluster data directory under a random - * subdirectory in a directory under System property test.build.data. - * Directory is cleaned up on exit. - * @param numMasters Number of masters to start up. We'll start this many - * hbase masters. If numMasters > 1, you can find the active/primary master - * with {@link MiniHBaseCluster#getMaster()}. - * @param numSlaves Number of slaves to start up. We'll start this many - * regionservers. If dataNodeHosts == null, this also indicates the number of - * datanodes to start. If dataNodeHosts != null, the number of datanodes is - * based on dataNodeHosts.length. - * If numSlaves is > 1, then make sure - * hbase.regionserver.info.port is -1 (i.e. no ui per regionserver) otherwise - * bind errors. - * @param dataNodeHosts hostnames DNs to run on. - * This is useful if you want to run datanode on distinct hosts for things - * like HDFS block location verification. - * If you start MiniDFSCluster without host names, - * all instances of the datanodes will have the same host name. - * @param masterClass The class to use as HMaster, or null for default - * @param regionserverClass The class to use as HRegionServer, or null for - * default - * @throws Exception - * @see #shutdownMiniCluster() - * @return Mini hbase cluster instance created. - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, final String[] dataNodeHosts, Class masterClass, - Class regionserverClass) - throws Exception { - return startMiniCluster( - numMasters, numSlaves, numSlaves, dataNodeHosts, masterClass, regionserverClass); - } - - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, int numDataNodes, final String[] dataNodeHosts, - Class masterClass, - Class regionserverClass) - throws Exception { - return startMiniCluster(numMasters, numSlaves, numDataNodes, dataNodeHosts, - masterClass, regionserverClass, false, false); - } - - /** - * Same as {@link #startMiniCluster(int, int, String[], Class, Class)}, but with custom - * number of datanodes. - * @param numDataNodes Number of data nodes. - * @param create Set this flag to create a new - * root or data directory path or not (will overwrite if exists already). - */ - public MiniHBaseCluster startMiniCluster(final int numMasters, - final int numSlaves, int numDataNodes, final String[] dataNodeHosts, - Class masterClass, - Class regionserverClass, - boolean create, boolean withWALDir) - throws Exception { - if (dataNodeHosts != null && dataNodeHosts.length != 0) { - numDataNodes = dataNodeHosts.length; - } - - LOG.info("Starting up minicluster with " + numMasters + " master(s) and " + - numSlaves + " regionserver(s) and " + numDataNodes + " datanode(s)"); + public MiniHBaseCluster startMiniCluster(StartMiniClusterOption option) throws Exception { + LOG.info("Starting up minicluster with option: {}", option); // If we already put up a cluster, fail. if (miniClusterRunning) { @@ -968,54 +1037,35 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility { // Bring up mini dfs cluster. This spews a bunch of warnings about missing // scheme. Complaints are 'Scheme is undefined for build/test/data/dfs/name1'. - if(this.dfsCluster == null) { + if (dfsCluster == null) { LOG.info("STARTING DFS"); - dfsCluster = startMiniDFSCluster(numDataNodes, dataNodeHosts); - } else LOG.info("NOT STARTING DFS"); + dfsCluster = startMiniDFSCluster(option.getNumDataNodes(), option.getDataNodeHosts()); + } else { + LOG.info("NOT STARTING DFS"); + } // Start up a zk cluster. if (getZkCluster() == null) { - startMiniZKCluster(); + startMiniZKCluster(option.getNumZkServers()); } // Start the MiniHBaseCluster - return startMiniHBaseCluster(numMasters, numSlaves, null, masterClass, - regionserverClass, create, withWALDir); - } - - public MiniHBaseCluster startMiniHBaseCluster(final int numMasters, final int numSlaves) - throws IOException, InterruptedException { - return startMiniHBaseCluster(numMasters, numSlaves, null); - } - - public MiniHBaseCluster startMiniHBaseCluster(final int numMasters, final int numSlaves, - List rsPorts) throws IOException, InterruptedException { - return startMiniHBaseCluster(numMasters, numSlaves, rsPorts, null, null, false, false); + return startMiniHBaseCluster(option); } /** - * Starts up mini hbase cluster. Usually used after call to - * {@link #startMiniCluster(int, int)} when doing stepped startup of clusters. + * Starts up mini hbase cluster. * Usually you won't want this. You'll usually want {@link #startMiniCluster()}. - * @param rsPorts Ports that RegionServer should use; pass ports if you want to test cluster - * restart where for sure the regionservers come up on same address+port (but - * just with different startcode); by default mini hbase clusters choose new - * arbitrary ports on each cluster start. - * @param create Whether to create a - * root or data directory path or not; will overwrite if exists already. + * This is useful when doing stepped startup of clusters. * @return Reference to the hbase mini hbase cluster. - * @throws IOException - * @throws InterruptedException - * @see #startMiniCluster() + * @see #startMiniCluster(StartMiniClusterOption) + * @see #shutdownMiniHBaseCluster() */ - public MiniHBaseCluster startMiniHBaseCluster(final int numMasters, - final int numSlaves, List rsPorts, Class masterClass, - Class regionserverClass, - boolean create, boolean withWALDir) - throws IOException, InterruptedException { + public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option) + throws IOException, InterruptedException { // Now do the mini hbase cluster. Set the hbase.rootdir in config. - createRootDir(create); - if (withWALDir) { + createRootDir(option.isCreateRootDir()); + if (option.isCreateWALDir()) { createWALRootDir(); } // Set the hbase.fs.tmp.dir config to make sure that we have some default value. This is @@ -1025,16 +1075,17 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility { // These settings will make the server waits until this exact number of // regions servers are connected. if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, -1) == -1) { - conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, numSlaves); + conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, option.getNumRegionServers()); } if (conf.getInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, -1) == -1) { - conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, numSlaves); + conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers()); } Configuration c = new Configuration(this.conf); TraceUtil.initTracer(c); this.hbaseCluster = - new MiniHBaseCluster(c, numMasters, numSlaves, rsPorts, masterClass, regionserverClass); + new MiniHBaseCluster(c, option.getNumMasters(), option.getNumRegionServers(), + option.getRsPorts(), option.getMasterClass(), option.getRsClass()); // Don't leave here till we've done a successful scan of the hbase:meta Table t = getConnection().getTable(TableName.META_TABLE_NAME); ResultScanner s = t.getScanner(new Scan()); @@ -1045,9 +1096,83 @@ public class HBaseTestingUtility extends HBaseZKTestingUtility { t.close(); getAdmin(); // create immediately the hbaseAdmin - LOG.info("Minicluster is up; activeMaster=" + this.getHBaseCluster().getMaster()); + LOG.info("Minicluster is up; activeMaster={}", getHBaseCluster().getMaster()); - return (MiniHBaseCluster)this.hbaseCluster; + return (MiniHBaseCluster) hbaseCluster; + } + + /** + * Starts up mini hbase cluster using default options. + * Default options can be found in {@link StartMiniClusterOption.Builder}. + * @see #startMiniHBaseCluster(StartMiniClusterOption) + * @see #shutdownMiniHBaseCluster() + */ + public MiniHBaseCluster startMiniHBaseCluster() throws IOException, InterruptedException { + return startMiniHBaseCluster(StartMiniClusterOption.builder().build()); + } + + /** + * Starts up mini hbase cluster. + * Usually you won't want this. You'll usually want {@link #startMiniCluster()}. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @return The mini HBase cluster created. + * @see #shutdownMiniHBaseCluster() + * @deprecated Use {@link #startMiniHBaseCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniHBaseCluster(int numMasters, int numRegionServers) + throws IOException, InterruptedException { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numRegionServers).build(); + return startMiniHBaseCluster(option); + } + + /** + * Starts up mini hbase cluster. + * Usually you won't want this. You'll usually want {@link #startMiniCluster()}. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @param rsPorts Ports that RegionServer should use. + * @return The mini HBase cluster created. + * @see #shutdownMiniHBaseCluster() + * @deprecated Use {@link #startMiniHBaseCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniHBaseCluster(int numMasters, int numRegionServers, + List rsPorts) throws IOException, InterruptedException { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).numRegionServers(numRegionServers).rsPorts(rsPorts).build(); + return startMiniHBaseCluster(option); + } + + /** + * Starts up mini hbase cluster. + * Usually you won't want this. You'll usually want {@link #startMiniCluster()}. + * All other options will use default values, defined in {@link StartMiniClusterOption.Builder}. + * @param numMasters Master node number. + * @param numRegionServers Number of region servers. + * @param rsPorts Ports that RegionServer should use. + * @param masterClass The class to use as HMaster, or null for default. + * @param rsClass The class to use as HRegionServer, or null for default. + * @param createRootDir Whether to create a new root or data directory path. + * @param createWALDir Whether to create a new WAL directory. + * @return The mini HBase cluster created. + * @see #shutdownMiniHBaseCluster() + * @deprecated Use {@link #startMiniHBaseCluster(StartMiniClusterOption)} instead. + */ + @Deprecated + public MiniHBaseCluster startMiniHBaseCluster(int numMasters, int numRegionServers, + List rsPorts, Class masterClass, + Class rsClass, + boolean createRootDir, boolean createWALDir) throws IOException, InterruptedException { + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(numMasters).masterClass(masterClass) + .numRegionServers(numRegionServers).rsClass(rsClass).rsPorts(rsPorts) + .createRootDir(createRootDir).createWALDir(createWALDir).build(); + return startMiniHBaseCluster(option); } /** diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/StartMiniClusterOption.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/StartMiniClusterOption.java new file mode 100644 index 00000000000..ad70c95b7c8 --- /dev/null +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/StartMiniClusterOption.java @@ -0,0 +1,254 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase; + +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.apache.hadoop.hbase.master.HMaster; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Options for starting up a mini cluster (including an hbase, dfs and zookeeper clusters) in test. + * The options include HDFS options to build mini dfs cluster, Zookeeper options to build mini zk + * cluster, and mostly HBase options to build mini hbase cluster. + * + * To create an object, use a {@link Builder}. + * Example usage: + *
+ *    StartMiniClusterOption option = StartMiniClusterOption.builder().
+ *        .numMasters(3).rsClass(MyRegionServer.class).createWALDir(true).build();
+ * 
+ * + * Default values can be found in {@link Builder}. + */ +@InterfaceAudience.Public +public final class StartMiniClusterOption { + /** + * Number of masters to start up. We'll start this many hbase masters. If numMasters > 1, you + * can find the active/primary master with {@link MiniHBaseCluster#getMaster()}. + */ + private final int numMasters; + /** + * The class to use as HMaster, or null for default. + */ + private final Class masterClass; + + /** + * Number of region servers to start up. + * If this value is > 1, then make sure config "hbase.regionserver.info.port" is -1 + * (i.e. no ui per regionserver) otherwise bind errors. + */ + private final int numRegionServers; + /** + * Ports that RegionServer should use. Pass ports if you want to test cluster restart where for + * sure the regionservers come up on same address+port (but just with different startcode); by + * default mini hbase clusters choose new arbitrary ports on each cluster start. + */ + private final List rsPorts; + /** + * The class to use as HRegionServer, or null for default. + */ + private Class rsClass; + + /** + * Number of datanodes. Used to create mini DSF cluster. Surpassed by {@link #dataNodeHosts} size. + */ + private final int numDataNodes; + /** + * The hostnames of DataNodes to run on. This is useful if you want to run datanode on distinct + * hosts for things like HDFS block location verification. If you start MiniDFSCluster without + * host names, all instances of the datanodes will have the same host name. + */ + private final String[] dataNodeHosts; + + /** + * Number of Zookeeper servers. + */ + private final int numZkServers; + + /** + * Whether to create a new root or data directory path. If true, the newly created data directory + * will be configured as HBase rootdir. This will overwrite existing root directory config. + */ + private final boolean createRootDir; + + /** + * Whether to create a new WAL directory. If true, the newly created directory will be configured + * as HBase wal.dir which is separate from HBase rootdir. + */ + private final boolean createWALDir; + + /** + * Private constructor. Use {@link Builder#build()}. + */ + private StartMiniClusterOption(int numMasters, Class masterClass, + int numRegionServers, List rsPorts, + Class rsClass, int numDataNodes, + String[] dataNodeHosts, int numZkServers, boolean createRootDir, boolean createWALDir) { + this.numMasters = numMasters; + this.masterClass = masterClass; + this.numRegionServers = numRegionServers; + this.rsPorts = rsPorts; + this.rsClass = rsClass; + this.numDataNodes = numDataNodes; + this.dataNodeHosts = dataNodeHosts; + this.numZkServers = numZkServers; + this.createRootDir = createRootDir; + this.createWALDir = createWALDir; + } + + public int getNumMasters() { + return numMasters; + } + + public Class getMasterClass() { + return masterClass; + } + + public int getNumRegionServers() { + return numRegionServers; + } + + public List getRsPorts() { + return rsPorts; + } + + public Class getRsClass() { + return rsClass; + } + + public int getNumDataNodes() { + return numDataNodes; + } + + public String[] getDataNodeHosts() { + return dataNodeHosts; + } + + public int getNumZkServers() { + return numZkServers; + } + + public boolean isCreateRootDir() { + return createRootDir; + } + + public boolean isCreateWALDir() { + return createWALDir; + } + + @Override + public String toString() { + return "StartMiniClusterOption{" + "numMasters=" + numMasters + ", masterClass=" + masterClass + + ", numRegionServers=" + numRegionServers + ", rsPorts=" + StringUtils.join(rsPorts) + + ", rsClass=" + rsClass + ", numDataNodes=" + numDataNodes + + ", dataNodeHosts=" + Arrays.toString(dataNodeHosts) + ", numZkServers=" + numZkServers + + ", createRootDir=" + createRootDir + ", createWALDir=" + createWALDir + '}'; + } + + /** + * @return a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Builder pattern for creating an {@link StartMiniClusterOption}. + * + * The default values of its fields should be considered public and constant. Changing the default + * values may cause other tests fail. + */ + public static final class Builder { + private int numMasters = 1; + private Class masterClass = null; + private int numRegionServers = 1; + private List rsPorts = null; + private Class rsClass = null; + private int numDataNodes = 1; + private String[] dataNodeHosts = null; + private int numZkServers = 1; + private boolean createRootDir = false; + private boolean createWALDir = false; + + private Builder() { + } + + public StartMiniClusterOption build() { + if (dataNodeHosts != null && dataNodeHosts.length != 0) { + numDataNodes = dataNodeHosts.length; + } + return new StartMiniClusterOption(numMasters, masterClass, numRegionServers, rsPorts, rsClass, + numDataNodes, dataNodeHosts, numZkServers, createRootDir, createWALDir); + } + + public Builder numMasters(int numMasters) { + this.numMasters = numMasters; + return this; + } + + public Builder masterClass(Class masterClass) { + this.masterClass = masterClass; + return this; + } + + public Builder numRegionServers(int numRegionServers) { + this.numRegionServers = numRegionServers; + return this; + } + + public Builder rsPorts(List rsPorts) { + this.rsPorts = rsPorts; + return this; + } + + public Builder rsClass(Class rsClass) { + this.rsClass = rsClass; + return this; + } + + public Builder numDataNodes(int numDataNodes) { + this.numDataNodes = numDataNodes; + return this; + } + + public Builder dataNodeHosts(String[] dataNodeHosts) { + this.dataNodeHosts = dataNodeHosts; + return this; + } + + public Builder numZkServers(int numZkServers) { + this.numZkServers = numZkServers; + return this; + } + + public Builder createRootDir(boolean createRootDir) { + this.createRootDir = createRootDir; + return this; + } + + public Builder createWALDir(boolean createWALDir) { + this.createWALDir = createWALDir; + return this; + } + } + +} diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java index a2605f272a5..ff04bb2b325 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterMetrics.java @@ -66,7 +66,9 @@ public class TestClientClusterMetrics { Configuration conf = HBaseConfiguration.create(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, MyObserver.class.getName()); UTIL = new HBaseTestingUtility(conf); - UTIL.startMiniCluster(MASTERS, SLAVES); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(MASTERS).numRegionServers(SLAVES).numDataNodes(SLAVES).build(); + UTIL.startMiniCluster(option); CLUSTER = UTIL.getHBaseCluster(); CLUSTER.waitForActiveAndReadyMaster(); ADMIN = UTIL.getAdmin(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java index 392ff6e4435..960b18d2b4d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java @@ -67,7 +67,9 @@ public class TestClientClusterStatus { Configuration conf = HBaseConfiguration.create(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, MyObserver.class.getName()); UTIL = new HBaseTestingUtility(conf); - UTIL.startMiniCluster(MASTERS, SLAVES); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(MASTERS).numRegionServers(SLAVES).numDataNodes(SLAVES).build(); + UTIL.startMiniCluster(option); CLUSTER = UTIL.getHBaseCluster(); CLUSTER.waitForActiveAndReadyMaster(); ADMIN = UTIL.getAdmin(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java index fa4e017f4cf..6c46e50fb17 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientOperationTimeout.java @@ -88,7 +88,10 @@ public class TestClientOperationTimeout { TESTING_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, 500); TESTING_UTIL.getConfiguration().setLong(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 1); - TESTING_UTIL.startMiniCluster(1, 1, null, null, DelayedRegionServer.class); + // Set RegionServer class and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder() + .rsClass(DelayedRegionServer.class).build(); + TESTING_UTIL.startMiniCluster(option); } @Before diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java index 2e2d978d4df..9aecf06626a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestGlobalMemStoreSize.java @@ -78,7 +78,7 @@ public class TestGlobalMemStoreSize { LOG.info("Starting cluster"); Configuration conf = HBaseConfiguration.create(); TEST_UTIL = new HBaseTestingUtility(conf); - TEST_UTIL.startMiniCluster(1, regionServerNum); + TEST_UTIL.startMiniCluster(regionServerNum); cluster = TEST_UTIL.getHBaseCluster(); LOG.info("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestLocalHBaseCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestLocalHBaseCluster.java index 4403739623b..7e9e7cb7af6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestLocalHBaseCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestLocalHBaseCluster.java @@ -47,7 +47,10 @@ public class TestLocalHBaseCluster { */ @Test public void testLocalHBaseCluster() throws Exception { - TEST_UTIL.startMiniCluster(1, 1, null, MyHMaster.class, MyHRegionServer.class); + // Set Master class and RegionServer class, and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder() + .masterClass(MyHMaster.class).rsClass(MyHRegionServer.class).build(); + TEST_UTIL.startMiniCluster(option); // Can we cast back to our master class? try { int val = ((MyHMaster)TEST_UTIL.getHBaseCluster().getMaster(0)).echo(42); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java index a7327401d7e..fe645bb469f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java @@ -150,7 +150,9 @@ public class TestMultiVersions { table.close(); UTIL.shutdownMiniHBaseCluster(); LOG.debug("HBase cluster shut down -- restarting"); - UTIL.startMiniHBaseCluster(1, NUM_SLAVES); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(NUM_SLAVES).build(); + UTIL.startMiniHBaseCluster(option); // Make a new connection. table = UTIL.getConnection().getTable(desc.getTableName()); // Overwrite previous value diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java index 2d579542ec5..a419e226d2c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestZooKeeper.java @@ -88,7 +88,9 @@ public class TestZooKeeper { @Before public void setUp() throws Exception { - TEST_UTIL.startMiniHBaseCluster(2, 2); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(2).build(); + TEST_UTIL.startMiniHBaseCluster(option); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java index 94528ea6628..22a09ebf554 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java @@ -63,7 +63,7 @@ public class TestAsyncClusterAdminApi2 extends TestAsyncAdminBase { @Before @Override public void setUp() throws Exception { - TEST_UTIL.startMiniCluster(1, 3); + TEST_UTIL.startMiniCluster(3); ASYNC_CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get(); admin = ASYNC_CONN.getAdmin(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestGetScanPartialResult.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestGetScanPartialResult.java index 0925aeee637..e9295c4fda0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestGetScanPartialResult.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestGetScanPartialResult.java @@ -52,7 +52,7 @@ public class TestGetScanPartialResult { @BeforeClass public static void setUp() throws Exception { - TEST_UTIL.startMiniCluster(1); + TEST_UTIL.startMiniCluster(); TEST_UTIL.createTable(TABLE, CF); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java index 533af935b5c..dce8e792c37 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSeparateClientZKCluster.java @@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.NoSuchProcedureException; @@ -82,7 +83,9 @@ public class TestSeparateClientZKCluster { // reduce zk session timeout to easier trigger session expiration TEST_UTIL.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, ZK_SESSION_TIMEOUT); // Start a cluster with 2 masters and 3 regionservers. - TEST_UTIL.startMiniCluster(2, 3); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(3).numDataNodes(3).build(); + TEST_UTIL.startMiniCluster(option); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java index 408953ad6ec..e999f8c381f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableSnapshotScanner.java @@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.master.snapshot.SnapshotManager; import org.apache.hadoop.hbase.snapshot.RestoreSnapshotHelper; @@ -74,7 +75,10 @@ public class TestTableSnapshotScanner { public void setupCluster() throws Exception { setupConf(UTIL.getConfiguration()); - UTIL.startMiniCluster(NUM_REGION_SERVERS, true); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(NUM_REGION_SERVERS).numDataNodes(NUM_REGION_SERVERS) + .createRootDir(true).build(); + UTIL.startMiniCluster(option); rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir(); fs = rootDir.getFileSystem(UTIL.getConfiguration()); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestUpdateConfiguration.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestUpdateConfiguration.java index 09dc40c74ae..eae56fdd53c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestUpdateConfiguration.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestUpdateConfiguration.java @@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.junit.BeforeClass; import org.junit.ClassRule; @@ -48,7 +49,9 @@ public class TestUpdateConfiguration { @BeforeClass public static void setup() throws Exception { - TEST_UTIL.startMiniCluster(2, 1); + // Set master number and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder().numMasters(2).build(); + TEST_UTIL.startMiniCluster(option); } @Test diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderBlockLocation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderBlockLocation.java index 5ef5ba4b8de..ce2877cfc61 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderBlockLocation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderBlockLocation.java @@ -101,7 +101,7 @@ public class TestBlockReorderBlockLocation { public void testBlockLocation() throws Exception { // We need to start HBase to get HConstants.HBASE_DIR set in conf htu.startMiniZKCluster(); - MiniHBaseCluster hbm = htu.startMiniHBaseCluster(1, 1); + MiniHBaseCluster hbm = htu.startMiniHBaseCluster(); conf = hbm.getConfiguration(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderMultiBlocks.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderMultiBlocks.java index 937b5dd662e..ad2b2d48aa9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderMultiBlocks.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/fs/TestBlockReorderMultiBlocks.java @@ -116,7 +116,7 @@ public class TestBlockReorderMultiBlocks { byte[] sb = Bytes.toBytes("sb"); htu.startMiniZKCluster(); - MiniHBaseCluster hbm = htu.startMiniHBaseCluster(1, 1); + MiniHBaseCluster hbm = htu.startMiniHBaseCluster(); hbm.waitForActiveAndReadyMaster(); HRegionServer targetRs = LoadBalancer.isTablesOnMaster(hbm.getConf())? hbm.getMaster(): hbm.getRegionServer(0); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java index bc4d32c3122..f828926a7ea 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/AbstractTestDLS.java @@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.NamespaceDescriptor; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.SplitLogCounters; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Put; @@ -146,7 +147,9 @@ public abstract class AbstractTestDLS { conf.setInt("hbase.regionserver.wal.max.splitters", 3); conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10); conf.set("hbase.wal.provider", getWalProvider()); - TEST_UTIL.startMiniHBaseCluster(NUM_MASTERS, numRS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(numRS).build(); + TEST_UTIL.startMiniHBaseCluster(option); cluster = TEST_UTIL.getHBaseCluster(); LOG.info("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetInfoPort.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetInfoPort.java index ddf2e83596b..5b27bf57812 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetInfoPort.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetInfoPort.java @@ -45,7 +45,7 @@ public class TestGetInfoPort { @Before public void setUp() throws Exception { testUtil.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0); - testUtil.startMiniCluster(1, 1); + testUtil.startMiniCluster(); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetLastFlushedSequenceId.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetLastFlushedSequenceId.java index c930a1b1e6d..387ccf84d55 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetLastFlushedSequenceId.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetLastFlushedSequenceId.java @@ -66,7 +66,7 @@ public class TestGetLastFlushedSequenceId { @Before public void setUp() throws Exception { testUtil.getConfiguration().setInt("hbase.regionserver.msginterval", 1000); - testUtil.startMiniCluster(1, 1); + testUtil.startMiniCluster(); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetReplicationLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetReplicationLoad.java index 836f4ffdd4a..bf72383b8d7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetReplicationLoad.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestGetReplicationLoad.java @@ -21,6 +21,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.replication.ReplicationLoadSource; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; import org.apache.hadoop.hbase.testclassification.MasterTests; @@ -66,7 +67,10 @@ public class TestGetReplicationLoad { public static void startCluster() throws Exception { LOG.info("Starting cluster"); TEST_UTIL = new HBaseTestingUtility(); - TEST_UTIL.startMiniCluster(1, 1, 1, null, TestMasterMetrics.MyMaster.class, null); + // Set master class and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder() + .masterClass(TestMasterMetrics.MyMaster.class).build(); + TEST_UTIL.startMiniCluster(option); cluster = TEST_UTIL.getHBaseCluster(); LOG.info("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java index b93c0152a54..a27936df07a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailover.java @@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.master.RegionState.State; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.testclassification.FlakeyTests; @@ -66,7 +67,9 @@ public class TestMasterFailover { // Start the cluster HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); try { - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + TEST_UTIL.startMiniCluster(option); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); // get all the master threads @@ -166,12 +169,9 @@ public class TestMasterFailover { */ @Test public void testMetaInTransitionWhenMasterFailover() throws Exception { - final int NUM_MASTERS = 1; - final int NUM_RS = 1; - // Start the cluster HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + TEST_UTIL.startMiniCluster(); try { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); LOG.info("Cluster started"); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java index 8678684f1a5..337cdfaa06f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFailoverBalancerPersistence.java @@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.util.JVMClusterUtil; @@ -49,13 +50,12 @@ public class TestMasterFailoverBalancerPersistence { */ @Test public void testMasterFailoverBalancerPersistence() throws Exception { - final int NUM_MASTERS = 3; - final int NUM_RS = 1; - // Start the cluster HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(3).build(); + TEST_UTIL.startMiniCluster(option); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); assertTrue(cluster.waitForActiveAndReadyMaster()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFileSystemWithWALDir.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFileSystemWithWALDir.java index d8f400ee773..62e5b5ba564 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFileSystemWithWALDir.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterFileSystemWithWALDir.java @@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; -import org.apache.hadoop.hbase.fs.HFileSystem; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.FSUtils; @@ -46,7 +46,8 @@ public class TestMasterFileSystemWithWALDir { @BeforeClass public static void setupTest() throws Exception { - UTIL.startMiniCluster(true); + // Set createWALDir to true and use default values for other options. + UTIL.startMiniCluster(StartMiniClusterOption.builder().createWALDir(true).build()); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java index 91955f802fd..dec65c823e3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java @@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.test.MetricsAssertHelper; import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.testclassification.MediumTests; @@ -71,7 +72,10 @@ public class TestMasterMetrics { public static void startCluster() throws Exception { LOG.info("Starting cluster"); TEST_UTIL = new HBaseTestingUtility(); - TEST_UTIL.startMiniCluster(1, 1, 1, null, MyMaster.class, null); + // Set master class and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder() + .masterClass(MyMaster.class).build(); + TEST_UTIL.startMiniCluster(option); cluster = TEST_UTIL.getHBaseCluster(); LOG.info("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java index ccc6104d0c6..395095e997b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetricsWrapper.java @@ -50,7 +50,7 @@ public class TestMasterMetricsWrapper { @BeforeClass public static void setup() throws Exception { - TEST_UTIL.startMiniCluster(1, NUM_RS); + TEST_UTIL.startMiniCluster(NUM_RS); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java index f1a45e1dfc0..3f4590c0424 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java @@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.MetaTableAccessor.Visitor; import org.apache.hadoop.hbase.RegionLocations; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; @@ -196,7 +197,9 @@ public class TestMasterOperationsForRegionReplicas { rsports.add(rst.getRegionServer().getRpcServer().getListenerAddress().getPort()); } TEST_UTIL.shutdownMiniHBaseCluster(); - TEST_UTIL.startMiniHBaseCluster(1, numSlaves, rsports); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(numSlaves).rsPorts(rsports).build(); + TEST_UTIL.startMiniHBaseCluster(option); TEST_UTIL.waitTableEnabled(tableName); validateFromSnapshotFromMeta(TEST_UTIL, tableName, numRegions, numReplica, ADMIN.getConnection()); @@ -204,7 +207,7 @@ public class TestMasterOperationsForRegionReplicas { // Now shut the whole cluster down, and verify regions are assigned even if there is only // one server running TEST_UTIL.shutdownMiniHBaseCluster(); - TEST_UTIL.startMiniHBaseCluster(1, 1); + TEST_UTIL.startMiniHBaseCluster(); TEST_UTIL.waitTableEnabled(tableName); validateSingleRegionServerAssignment(ADMIN.getConnection(), numRegions, numReplica); for (int i = 1; i < numSlaves; i++) { //restore the cluster diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterRestartAfterDisablingTable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterRestartAfterDisablingTable.java index 234d563b98f..665e5c6df66 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterRestartAfterDisablingTable.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterRestartAfterDisablingTable.java @@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.RegionLocator; @@ -61,14 +62,15 @@ public class TestMasterRestartAfterDisablingTable { public void testForCheckingIfEnableAndDisableWorksFineAfterSwitch() throws Exception { final int NUM_MASTERS = 2; - final int NUM_RS = 1; final int NUM_REGIONS_TO_CREATE = 4; // Start the cluster log("Starting cluster"); Configuration conf = HBaseConfiguration.create(); HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).build(); + TEST_UTIL.startMiniCluster(option); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); log("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java index 63cfe1f0c9c..a512833b56a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.LocalHBaseCluster; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; @@ -66,7 +67,9 @@ public class TestMasterShutdown { // Start the cluster HBaseTestingUtility htu = new HBaseTestingUtility(conf); - htu.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + htu.startMiniCluster(option); MiniHBaseCluster cluster = htu.getHBaseCluster(); // get all the master threads diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaAssignmentWithStopMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaAssignmentWithStopMaster.java index b0878900dc2..446c3f9cb08 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaAssignmentWithStopMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaAssignmentWithStopMaster.java @@ -23,6 +23,7 @@ import static org.junit.Assert.fail; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.client.ConnectionFactory; @@ -50,7 +51,9 @@ public class TestMetaAssignmentWithStopMaster { @BeforeClass public static void setUp() throws Exception { - UTIL.startMiniCluster(2,3); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(3).numDataNodes(3).build(); + UTIL.startMiniCluster(option); } @Test diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java index 9497210233b..ea532daef0e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.MiniHBaseCluster.MiniHBaseClusterRegionServer; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.master.assignment.RegionStates; import org.apache.hadoop.hbase.testclassification.MediumTests; @@ -60,7 +61,9 @@ public class TestMetaShutdownHandler { @BeforeClass public static void setUpBeforeClass() throws Exception { - TEST_UTIL.startMiniCluster(1, 3, null, null, MyRegionServer.class); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(3).rsClass(MyRegionServer.class).numDataNodes(3).build(); + TEST_UTIL.startMiniCluster(option); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java index 8ecb49d9f93..ff8ad0b339c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRollingRestart.java @@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionLocator; @@ -78,7 +79,9 @@ public class TestRollingRestart { log("Starting cluster"); Configuration conf = HBaseConfiguration.create(); HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + TEST_UTIL.startMiniCluster(option); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); log("Waiting for active/ready master"); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestShutdownBackupMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestShutdownBackupMaster.java index 9475d600a46..d3a85209cca 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestShutdownBackupMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestShutdownBackupMaster.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.util.JVMClusterUtil.MasterThread; @@ -72,7 +73,9 @@ public class TestShutdownBackupMaster { @BeforeClass public static void setUpBeforeClass() throws Exception { UTIL.getConfiguration().setClass(HConstants.MASTER_IMPL, MockHMaster.class, HMaster.class); - UTIL.startMiniCluster(2, 2); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(2).numDataNodes(2).build(); + UTIL.startMiniCluster(option); UTIL.waitUntilAllSystemRegionsAssigned(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java index 2e9c4172982..05047c6dfca 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionMoveAndAbandon.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Get; @@ -69,7 +70,8 @@ public class TestRegionMoveAndAbandon { public void setup() throws Exception { UTIL = new HBaseTestingUtility(); zkCluster = UTIL.startMiniZKCluster(); - cluster = UTIL.startMiniHBaseCluster(1, 2); + StartMiniClusterOption option = StartMiniClusterOption.builder().numRegionServers(2).build(); + cluster = UTIL.startMiniHBaseCluster(option); rs1 = cluster.getRegionServer(0); rs2 = cluster.getRegionServer(1); assertEquals(2, cluster.getRegionServerThreads().size()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java index e4613ea2486..0362e13c944 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java @@ -61,7 +61,7 @@ public class TestRegionLocationFinder { @BeforeClass public static void setUpBeforeClass() throws Exception { - cluster = TEST_UTIL.startMiniCluster(1, ServerNum); + cluster = TEST_UTIL.startMiniCluster(ServerNum); table = TEST_UTIL.createTable(tableName, FAMILY, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); TEST_UTIL.waitTableAvailable(tableName, 1000); TEST_UTIL.loadTable(table, FAMILY); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java index 9f551c8c1ca..3b1cfeda251 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java @@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.master.HMaster; @@ -157,7 +158,9 @@ public class TestRegionsOnMasterOptions { } private void checkBalance(int masterCount, int rsCount) throws Exception { - MiniHBaseCluster cluster = TEST_UTIL.startMiniCluster(MASTERS, SLAVES); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(MASTERS).numRegionServers(SLAVES).numDataNodes(SLAVES).build(); + MiniHBaseCluster cluster = TEST_UTIL.startMiniCluster(option); TableName tn = TableName.valueOf(this.name.getMethodName()); try { Table t = TEST_UTIL.createMultiRegionTable(tn, HConstants.CATALOG_FAMILY, REGIONS); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java index 48a3237f2a5..fe05dbe919d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterFailoverWithProcedures.java @@ -23,6 +23,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.TableDescriptor; @@ -72,7 +73,9 @@ public class TestMasterFailoverWithProcedures { @Before public void setup() throws Exception { setupConf(UTIL.getConfiguration()); - UTIL.startMiniCluster(2, 1); + // Set master number and use default values for other options. + StartMiniClusterOption option = StartMiniClusterOption.builder().numMasters(2).build(); + UTIL.startMiniCluster(option); final ProcedureExecutor procExec = getMasterProcedureExecutor(); ProcedureTestingUtility.setToggleKillBeforeStoreUpdate(procExec, false); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureWalLease.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureWalLease.java index 174033511b8..37bc6de52b1 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureWalLease.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/procedure/TestMasterProcedureWalLease.java @@ -26,6 +26,7 @@ import java.util.concurrent.CountDownLatch; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.TableDescriptor; @@ -76,7 +77,9 @@ public class TestMasterProcedureWalLease { @Before public void setup() throws Exception { setupConf(UTIL.getConfiguration()); - UTIL.startMiniCluster(2, 3); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(3).numDataNodes(3).build(); + UTIL.startMiniCluster(option); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java index cc6c217ddd3..a5d12b71055 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java @@ -118,7 +118,7 @@ public class TestNamespaceAuditor { conf.setBoolean(QuotaUtil.QUOTA_CONF_KEY, true); conf.setClass("hbase.coprocessor.regionserver.classes", CPRegionServerObserver.class, RegionServerObserver.class); - UTIL.startMiniCluster(1, 1); + UTIL.startMiniCluster(); waitForQuotaInitialize(UTIL); ADMIN = UTIL.getAdmin(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java index c20c42ec522..47fc2d7221a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java @@ -59,7 +59,6 @@ public class TestClearRegionBlockCache { private static final TableName TABLE_NAME = TableName.valueOf("testClearRegionBlockCache"); private static final byte[] FAMILY = Bytes.toBytes("family"); private static final byte[][] SPLIT_KEY = new byte[][] { Bytes.toBytes("5") }; - private static final int NUM_MASTERS = 1; private static final int NUM_RS = 2; private final HBaseTestingUtility HTU = new HBaseTestingUtility(); @@ -83,7 +82,7 @@ public class TestClearRegionBlockCache { CONF.setInt(HConstants.BUCKET_CACHE_SIZE_KEY, 30); } - cluster = HTU.startMiniCluster(NUM_MASTERS, NUM_RS); + cluster = HTU.startMiniCluster(NUM_RS); rs1 = cluster.getRegionServer(0); rs2 = cluster.getRegionServer(1); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java index e0323a0fa1e..189fd2ea160 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java @@ -27,6 +27,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.testclassification.MediumTests; @@ -82,7 +83,9 @@ public class TestClusterId { //Make sure RS is in blocking state Thread.sleep(10000); - TEST_UTIL.startMiniHBaseCluster(1, 0); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(1).numRegionServers(0).build(); + TEST_UTIL.startMiniHBaseCluster(option); rst.waitForServerOnline(); @@ -108,7 +111,7 @@ public class TestClusterId { s.close(); } } - TEST_UTIL.startMiniHBaseCluster(1, 1); + TEST_UTIL.startMiniHBaseCluster(); HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); int expected = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration())? 2: 1; assertEquals(expected, master.getServerManager().getOnlineServersList().size()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java index 52d6aae81dd..3a212f88161 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java @@ -198,7 +198,7 @@ public class TestEncryptionKeyRotation { conf.set(HConstants.CRYPTO_MASTERKEY_ALTERNATE_NAME_CONF_KEY, "hbase"); // Start the cluster back up - TEST_UTIL.startMiniHBaseCluster(1, 1); + TEST_UTIL.startMiniHBaseCluster(); // Verify the table can still be loaded TEST_UTIL.waitTableAvailable(htd.getTableName(), 5000); // Double check that the store file keys can be unwrapped diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java index f3120e5f1f6..c9c3392dadf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java @@ -95,6 +95,7 @@ import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.RegionTooBusyException; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TagType; import org.apache.hadoop.hbase.Waiter; @@ -4284,7 +4285,9 @@ public class TestHRegion { int regionServersCount = 3; try { - cluster = htu.startMiniCluster(1, regionServersCount, dataNodeHosts); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(regionServersCount).dataNodeHosts(dataNodeHosts).build(); + cluster = htu.startMiniCluster(option); byte[][] families = { fam1, fam2 }; Table ht = htu.createTable(tableName, families); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java index 22ffeb01335..0681c377eed 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java @@ -70,10 +70,9 @@ public class TestHRegionOnCluster { @Test public void testDataCorrectnessReplayingRecoveredEdits() throws Exception { - final int NUM_MASTERS = 1; final int NUM_RS = 3; Admin hbaseAdmin = null; - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + TEST_UTIL.startMiniCluster(NUM_RS); try { final TableName tableName = TableName.valueOf(name.getMethodName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java index 51d2f0230ae..c86f3e11ef0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionServerBulkLoad.java @@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.MultithreadedTestUtil.RepeatingTestThread; import org.apache.hadoop.hbase.MultithreadedTestUtil.TestContext; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableExistsException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.ClientServiceCallable; @@ -375,7 +376,8 @@ public class TestHRegionServerBulkLoad { int millisToRun = 30000; int numScanners = 50; - UTIL.startMiniCluster(1, false, true); + // Set createWALDir to true and use default values for other options. + UTIL.startMiniCluster(StartMiniClusterOption.builder().createWALDir(true).build()); try { WAL log = UTIL.getHBaseCluster().getRegionServer(0).getWAL(null); FindBulkHBaseListener listener = new FindBulkHBaseListener(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java index 3e23eeaba75..3aa35e1cc52 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestJoinedScanners.java @@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; @@ -98,7 +99,9 @@ public class TestJoinedScanners { String[] dataNodeHosts = new String[] {"host1", "host2", "host3"}; int regionServersCount = 3; - TEST_UTIL.startMiniCluster(1, regionServersCount, dataNodeHosts); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numRegionServers(regionServersCount).dataNodeHosts(dataNodeHosts).build(); + TEST_UTIL.startMiniCluster(option); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java index 52ed7ba2f46..9d9226ef265 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java @@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.UnknownRegionException; import org.apache.hadoop.hbase.client.Admin; @@ -117,7 +118,9 @@ public class TestRegionMergeTransactionOnCluster { @BeforeClass public static void beforeAllTests() throws Exception { // Start a cluster - TEST_UTIL.startMiniCluster(1, NB_SERVERS, null, MyMaster.class, null); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .masterClass(MyMaster.class).numRegionServers(NB_SERVERS).numDataNodes(NB_SERVERS).build(); + TEST_UTIL.startMiniCluster(option); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); MASTER = cluster.getMaster(); MASTER.balanceSwitch(false); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerAbort.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerAbort.java index d5cbad01c45..132d229218f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerAbort.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerAbort.java @@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Durability; @@ -101,7 +102,8 @@ public class TestRegionServerAbort { testUtil.startMiniZKCluster(); dfsCluster = testUtil.startMiniDFSCluster(2); - cluster = testUtil.startMiniHBaseCluster(1, 2); + StartMiniClusterOption option = StartMiniClusterOption.builder().numRegionServers(2).build(); + cluster = testUtil.startMiniHBaseCluster(option); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java index 131158b29a5..a90b40a2aa7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java @@ -30,6 +30,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.master.LoadBalancer; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.RegionServerTests; @@ -103,7 +104,9 @@ public class TestRegionServerHostname { TEST_UTIL.getConfiguration().set(HRegionServer.MASTER_HOSTNAME_KEY, hostName); TEST_UTIL.getConfiguration().set(HRegionServer.RS_HOSTNAME_KEY, hostName); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + TEST_UTIL.startMiniCluster(option); try { ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); List servers = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); @@ -143,7 +146,9 @@ public class TestRegionServerHostname { TEST_UTIL.getConfiguration().set(HRegionServer.RS_HOSTNAME_KEY, hostName); TEST_UTIL.getConfiguration().setBoolean(HRegionServer.RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY, true); try { - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + TEST_UTIL.startMiniCluster(option); } catch (Exception e) { Throwable t1 = e.getCause(); Throwable t2 = t1.getCause(); @@ -163,7 +168,9 @@ public class TestRegionServerHostname { public void testRegionServerHostnameReportedToMaster() throws Exception { TEST_UTIL.getConfiguration().setBoolean(HRegionServer.RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY, true); - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build(); + TEST_UTIL.startMiniCluster(option); boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration()); int expectedRS = NUM_RS + (tablesOnMaster? 1: 0); try (ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher()) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java index fab6512602d..5754edbc9a7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerMetrics.java @@ -114,7 +114,7 @@ public class TestRegionServerMetrics { conf.setInt("hbase.hstore.compaction.max", 100); conf.setInt(HConstants.REGIONSERVER_INFO_PORT, -1); - TEST_UTIL.startMiniCluster(1, 1); + TEST_UTIL.startMiniCluster(); cluster = TEST_UTIL.getHBaseCluster(); cluster.waitForActiveAndReadyMaster(); admin = TEST_UTIL.getAdmin(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java index 08d0bd50f47..7eedafc03c8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java @@ -73,7 +73,7 @@ public class TestRegionServerOnlineConfigChange { @BeforeClass public static void setUp() throws Exception { conf = hbaseTestingUtility.getConfiguration(); - hbaseTestingUtility.startMiniCluster(1,1); + hbaseTestingUtility.startMiniCluster(); t1 = hbaseTestingUtility.createTable(TABLE1, COLUMN_FAMILY1); try (RegionLocator locator = hbaseTestingUtility.getConnection().getRegionLocator(TABLE1)) { HRegionInfo firstHRI = locator.getAllRegionLocations().get(0).getRegionInfo(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java index 27bd45c1673..45469116579 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRemoveRegionMetrics.java @@ -68,7 +68,7 @@ public class TestRemoveRegionMetrics { conf.setInt("zookeeper.recovery.retry", 0); conf.setInt(HConstants.REGIONSERVER_INFO_PORT, -1); - TEST_UTIL.startMiniCluster(1, 2); + TEST_UTIL.startMiniCluster(2); cluster = TEST_UTIL.getHBaseCluster(); cluster.waitForActiveAndReadyMaster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java index b9a1e4ab60f..4873c7c56f0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java @@ -47,6 +47,7 @@ import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.MetaTableAccessor; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.UnknownRegionException; import org.apache.hadoop.hbase.ZooKeeperConnectionException; @@ -138,7 +139,9 @@ public class TestSplitTransactionOnCluster { @BeforeClass public static void before() throws Exception { TESTING_UTIL.getConfiguration().setInt(HConstants.HBASE_BALANCER_PERIOD, 60000); - TESTING_UTIL.startMiniCluster(1, NB_SERVERS, null, MyMaster.class, null); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .masterClass(MyMaster.class).numRegionServers(NB_SERVERS).numDataNodes(NB_SERVERS).build(); + TESTING_UTIL.startMiniCluster(option); } @AfterClass public static void after() throws Exception { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java index 682d951d790..531edc88101 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java @@ -92,7 +92,7 @@ public class TestTags { conf.setInt("hfile.format.version", 3); conf.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, TestCoprocessorForTags.class.getName()); - TEST_UTIL.startMiniCluster(1, 2); + TEST_UTIL.startMiniCluster(2); } @AfterClass diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestLogRolling.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestLogRolling.java index 610af61fec0..83bd9abecd0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestLogRolling.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/AbstractTestLogRolling.java @@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MiniHBaseCluster; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; @@ -119,7 +120,8 @@ public abstract class AbstractTestLogRolling { @Before public void setUp() throws Exception { - TEST_UTIL.startMiniCluster(1, 1, 2); + // Use 2 DataNodes and default values for other StartMiniCluster options. + TEST_UTIL.startMiniCluster(StartMiniClusterOption.builder().numDataNodes(2).build()); cluster = TEST_UTIL.getHBaseCluster(); dfsCluster = TEST_UTIL.getDFSCluster(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDisableInactivePeer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDisableInactivePeer.java index 8b795aa4235..dbb5164e690 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDisableInactivePeer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDisableInactivePeer.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.fail; import org.apache.hadoop.hbase.HBaseClassTestRule; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; @@ -65,7 +66,8 @@ public class TestReplicationDisableInactivePeer extends TestReplicationBase { // disable and start the peer admin.disablePeer("2"); - utility2.startMiniHBaseCluster(1, 2); + StartMiniClusterOption option = StartMiniClusterOption.builder().numRegionServers(2).build(); + utility2.startMiniHBaseCluster(option); Get get = new Get(rowkey); for (int i = 0; i < NB_RETRIES; i++) { Result res = htable2.get(get); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java index f280c7c193a..31750a8bf9b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.java @@ -149,7 +149,7 @@ public class TestReplicationDroppedTables extends TestReplicationBase { // make sure we have a single region server only, so that all // edits for all tables go there utility1.shutdownMiniHBaseCluster(); - utility1.startMiniHBaseCluster(1, 1); + utility1.startMiniHBaseCluster(); TableName tablename = TableName.valueOf(tName); byte[] familyName = Bytes.toBytes("fam"); @@ -224,7 +224,7 @@ public class TestReplicationDroppedTables extends TestReplicationBase { // make sure we have a single region server only, so that all // edits for all tables go there utility1.shutdownMiniHBaseCluster(); - utility1.startMiniHBaseCluster(1, 1); + utility1.startMiniHBaseCluster(); TableName tablename = TableName.valueOf("testdroppedtimed"); byte[] familyName = Bytes.toBytes("fam"); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestGlobalReplicationThrottler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestGlobalReplicationThrottler.java index bf649464616..6078f55e1a0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestGlobalReplicationThrottler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestGlobalReplicationThrottler.java @@ -102,8 +102,8 @@ public class TestGlobalReplicationThrottler { ReplicationPeerConfig rpc = new ReplicationPeerConfig(); rpc.setClusterKey(utility2.getClusterKey()); - utility1.startMiniCluster(1, 1); - utility2.startMiniCluster(1, 1); + utility1.startMiniCluster(); + utility2.startMiniCluster(); admin1.addPeer("peer1", rpc, null); admin1.addPeer("peer2", rpc, null); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java index 4513dd2f3cb..b1fc5b98be3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java @@ -25,6 +25,7 @@ import java.util.LinkedList; import java.util.List; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Put; @@ -63,7 +64,9 @@ public class TestHTraceHooks { @BeforeClass public static void before() throws Exception { - TEST_UTIL.startMiniCluster(2, 3); + StartMiniClusterOption option = StartMiniClusterOption.builder() + .numMasters(2).numRegionServers(3).numDataNodes(3).build(); + TEST_UTIL.startMiniCluster(option); rcvr = new POJOSpanReceiver(new HBaseHTraceConfiguration(TEST_UTIL.getConfiguration())); TraceUtil.addReceiver(rcvr); TraceUtil.addSampler(new Sampler() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java index a7f1409e3da..f2973d6cad1 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java @@ -109,7 +109,7 @@ public class TestMiniClusterLoadSequential { @Before public void setUp() throws Exception { LOG.debug("Test setup: isMultiPut=" + isMultiPut); - TEST_UTIL.startMiniCluster(1, NUM_RS); + TEST_UTIL.startMiniCluster(NUM_RS); } @After diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java index 3739d68a6b1..b9e238a44e6 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFiltering.java @@ -56,7 +56,6 @@ public class TestWALFiltering { public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestWALFiltering.class); - private static final int NUM_MASTERS = 1; private static final int NUM_RS = 4; private static final TableName TABLE_NAME = @@ -69,7 +68,7 @@ public class TestWALFiltering { @Before public void setUp() throws Exception { - TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); + TEST_UTIL.startMiniCluster(NUM_RS); fillTable(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java index d9775a535dd..7d7896c3f99 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALOpenAfterDNRollingStart.java @@ -80,7 +80,7 @@ public class TestWALOpenAfterDNRollingStart { @Before public void setUp() throws IOException, InterruptedException { TEST_UTIL.getConfiguration().set("hbase.wal.provider", walProvider); - TEST_UTIL.startMiniHBaseCluster(1, 1); + TEST_UTIL.startMiniHBaseCluster(); } @After diff --git a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java index 55260696fdb..9c28cbf5b75 100644 --- a/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java +++ b/hbase-shell/src/test/rsgroup/org/apache/hadoop/hbase/client/rsgroup/TestShellRSGroups.java @@ -76,7 +76,7 @@ public class TestShellRSGroups { CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, RSGroupAdminEndpoint.class.getName()); - TEST_UTIL.startMiniCluster(1,4); + TEST_UTIL.startMiniCluster(4); // Configure jruby runtime List loadPaths = new ArrayList<>(2);