virajjasani commented on a change in pull request #3308:
URL: https://github.com/apache/hbase/pull/3308#discussion_r640376122
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/TestClusterPortAssignment.java
##########
@@ -67,17 +72,22 @@ public void testClusterPortAssignment() throws Exception {
assertEquals("RS info port is incorrect", rsInfoPort,
cluster.getRegionServer(0).getInfoServer().getPort());
} catch (Exception e) {
- if (e instanceof BindException || e.getCause() != null &&
- (e.getCause() instanceof BindException || e.getCause().getCause()
!= null &&
- e.getCause().getCause() instanceof BindException)) {
+ Throwable rootCause = ExceptionUtils.getRootCause(e);
+ if (rootCause instanceof BindException) {
LOG.info("Failed bind, need to retry", e);
retry = true;
+ retryCount++;
} else {
- throw e;
+ retry = false;
+ fail("Failed to start mini cluster" + e);
Review comment:
Rather than including Exception message with Assert.fail, let's log it
separately just above this line (similar to `if` part) and here we can exclude
it from `fail`, we can full stacktrace in log anyways.
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/TestClusterPortAssignment.java
##########
@@ -44,16 +45,20 @@
@Test
public void testClusterPortAssignment() throws Exception {
boolean retry = false;
Review comment:
nit: just keeping `boolean retry;` should be good
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/TestClusterPortAssignment.java
##########
@@ -44,16 +45,20 @@
@Test
public void testClusterPortAssignment() throws Exception {
boolean retry = false;
+ int retryCount = 0;
do {
int masterPort = HBaseTestingUtility.randomFreePort();
int masterInfoPort = HBaseTestingUtility.randomFreePort();
int rsPort = HBaseTestingUtility.randomFreePort();
int rsInfoPort = HBaseTestingUtility.randomFreePort();
TEST_UTIL.getConfiguration().setBoolean(LocalHBaseCluster.ASSIGN_RANDOM_PORTS,
false);
+
TEST_UTIL.getConfiguration().setBoolean(HConstants.REGIONSERVER_INFO_PORT_AUTO,
false);
+ TEST_UTIL.getConfiguration().setBoolean("fs.hdfs.impl.disable.cache",
true);
TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_PORT, masterPort);
TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT,
masterInfoPort);
TEST_UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_PORT,
rsPort);
TEST_UTIL.getConfiguration().setInt(HConstants.REGIONSERVER_INFO_PORT,
rsInfoPort);
+ LOG.info("Ports: " + masterPort + ", " + masterInfoPort + ", " + rsPort
+ ", " + rsInfoPort);
Review comment:
nit: simplified
```
LOG.info("Ports: {}, {}, {}, {}", masterPort, masterInfoPort, rsPort,
rsInfoPort);
```
--
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]