ndimiduk commented on a change in pull request #954: HBASE-23305: Master based
registry implementation
URL: https://github.com/apache/hbase/pull/954#discussion_r362674414
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
##########
@@ -81,46 +85,60 @@
private static final Logger LOG =
LoggerFactory.getLogger(TestScannersFromClientSide.class);
- private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
+ private static HBaseTestingUtility TEST_UTIL;
private static byte [] ROW = Bytes.toBytes("testRow");
private static byte [] FAMILY = Bytes.toBytes("testFamily");
private static byte [] QUALIFIER = Bytes.toBytes("testQualifier");
private static byte [] VALUE = Bytes.toBytes("testValue");
@Rule
- public TestName name = new TestName();
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- Configuration conf = TEST_UTIL.getConfiguration();
- conf.setLong(HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, 10 *
1024 * 1024);
- TEST_UTIL.startMiniCluster(3);
- }
+ public TestTableName name = new TestTableName();
@AfterClass
public static void tearDownAfterClass() throws Exception {
- TEST_UTIL.shutdownMiniCluster();
+ if (TEST_UTIL != null) {
+ TEST_UTIL.shutdownMiniCluster();
+ }
}
- @Before
- public void setUp() throws Exception {
- // Nothing to do.
+ @Parameterized.Parameters
+ public static Collection parameters() {
+ return Arrays.asList(new Object[][] {
+ { MasterRegistry.class, 1},
+ { MasterRegistry.class, 2},
+ { ZKAsyncRegistry.class, 1}
+ });
}
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- // Nothing to do.
+ public TestScannersFromClientSide(Class registryImpl, int numHedgedReqs)
throws Exception {
+ if (TEST_UTIL != null) {
+ // Might be a remnant of another parameterized run. JUnit does not
provide a hook to run after
+ // each parameterized test run.
+ TEST_UTIL.shutdownMiniCluster();
+ }
+ TEST_UTIL = new HBaseTestingUtility();
+ Configuration conf = TEST_UTIL.getConfiguration();
+ conf.setLong(HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY, 10 *
1024 * 1024);
+ conf.setClass(HConstants.REGISTRY_IMPL_CONF_KEY, registryImpl,
AsyncRegistry.class);
+ if (numHedgedReqs == 1) {
+ conf.setBoolean(HConstants.MASTER_REGISTRY_ENABLE_HEDGED_READS_KEY,
false);
+ } else {
+ Preconditions.checkArgument(numHedgedReqs > 1);
+ conf.setBoolean(HConstants.MASTER_REGISTRY_ENABLE_HEDGED_READS_KEY,
true);
+ conf.setInt(HConstants.HBASE_RPCS_HEDGED_REQS_FANOUT_KEY, numHedgedReqs);
+ }
+ StartMiniClusterOption.Builder builder = StartMiniClusterOption.builder();
+ // Multiple masters needed only when hedged reads for master registry are
enabled.
+ builder.numMasters(numHedgedReqs > 1 ? 3 : 1).numRegionServers(3);
+ TEST_UTIL.startMiniCluster(builder.build());
}
/**
* Test from client side for batch of scan
*/
@Test
public void testScanBatch() throws Exception {
- final TableName tableName = TableName.valueOf(name.getMethodName());
+ final TableName tableName = name.getTableName();
Review comment:
same question about test method name in the `@Before` method.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services