HBASE-12541 Add misc debug logging to hanging tests in TestHCM and TestBaseLoadBalancer

This commit is contained in:
stack 2014-11-20 17:54:39 -08:00
parent a16b4e0fd5
commit c5690b1be3
3 changed files with 17 additions and 13 deletions

View File

@ -1007,7 +1007,7 @@ public class TestHCM {
return prevNumRetriesVal;
}
@Test
@Test (timeout=30000)
public void testMulti() throws Exception {
HTable table = TEST_UTIL.createTable(TABLE_NAME3, FAM_NAM);
TEST_UTIL.createMultiRegions(table, FAM_NAM);
@ -1024,9 +1024,7 @@ public class TestHCM {
HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
// We can wait for all regions to be online, that makes log reading easier when debugging
while (master.getAssignmentManager().getRegionStates().isRegionsInTransition()) {
Thread.sleep(1);
}
TEST_UTIL.waitUntilNoRegionsInTransition(20000);
Put put = new Put(ROW_X);
put.add(FAM_NAM, ROW_X, ROW_X);
@ -1034,6 +1032,12 @@ public class TestHCM {
// Now moving the region to the second server
HRegionLocation toMove = conn.getCachedLocation(TABLE_NAME3, ROW_X).getRegionLocation();
if (toMove == null) {
String msg = "Failed to find location for " + Bytes.toString(ROW_X) + " in " + TABLE_NAME3;
// Log so easier to see in output where error occurred.
LOG.error(msg);
throw new NullPointerException(msg);
}
byte[] regionName = toMove.getRegionInfo().getRegionName();
byte[] encodedRegionNameBytes = toMove.getRegionInfo().getEncodedNameAsBytes();

View File

@ -331,7 +331,6 @@ public class TestMultiParallel {
public void testBatchWithPut() throws Exception {
LOG.info("test=testBatchWithPut");
Table table = new HTable(UTIL.getConfiguration(), TEST_TABLE);
// put multiple rows using a batch
List<Row> puts = constructPutRequests();
@ -677,6 +676,7 @@ public class TestMultiParallel {
private void validateLoadedData(Table table) throws IOException {
// get the data back and validate that it is correct
LOG.info("Validating data on " + table);
for (byte[] k : KEYS) {
Get get = new Get(k);
get.addColumn(BYTES_FAMILY, QUALIFIER);

View File

@ -115,7 +115,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
*
* @throws Exception
*/
@Test
@Test (timeout=30000)
public void testImmediateAssignment() throws Exception {
List<ServerName> tmp = getListOfServerNames(randomServers(1, 0));
tmp.add(master);
@ -161,7 +161,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
*
* @throws Exception
*/
@Test
@Test (timeout=180000)
public void testBulkAssignment() throws Exception {
List<ServerName> tmp = getListOfServerNames(randomServers(5, 0));
List<HRegionInfo> hris = randomRegions(20);
@ -200,7 +200,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
* assignment info.
* @throws Exception
*/
@Test
@Test (timeout=180000)
public void testRetainAssignment() throws Exception {
// Test simple case where all same servers are there
List<ServerAndLoad> servers = randomServers(10, 10);
@ -236,7 +236,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
assertRetainedAssignment(existing, listOfServerNames, assignment);
}
@Test
@Test (timeout=180000)
public void testRegionAvailability() throws Exception {
// Create a cluster with a few servers, assign them to specific racks
// then assign some regions. The tests should check whether moving a
@ -310,7 +310,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
assertTrue(!cluster.wouldLowerAvailability(hri1, servers[6]));
}
@Test
@Test (timeout=180000)
public void testRegionAvailabilityWithRegionMoves() throws Exception {
List<HRegionInfo> list0 = new ArrayList<HRegionInfo>();
List<HRegionInfo> list1 = new ArrayList<HRegionInfo>();
@ -422,7 +422,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
}
}
@Test
@Test (timeout=180000)
public void testClusterServersWithSameHostPort() {
// tests whether the BaseLoadBalancer.Cluster can be constructed with servers
// sharing same host and port
@ -462,7 +462,7 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
}
}
@Test
@Test (timeout=180000)
public void testClusterRegionLocations() {
// tests whether region locations are handled correctly in Cluster
List<ServerName> servers = getListOfServerNames(randomServers(10, 10));
@ -521,4 +521,4 @@ public class TestBaseLoadBalancer extends BalancerTestBase {
assertEquals(1, cluster.regionLocations[r43].length);
assertEquals(-1, cluster.regionLocations[r43][0]);
}
}
}