HBASE-19837 Flakey TestRegionLoad

Add debug, change name of the rows so readable.
This commit is contained in:
Michael Stack 2018-01-21 23:03:16 -08:00
parent c1470714bb
commit b44be75bd1
1 changed files with 19 additions and 7 deletions

View File

@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -43,10 +44,12 @@ import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Category({MiscTests.class, MediumTests.class})
public class TestRegionLoad {
private static final Logger LOG = LoggerFactory.getLogger(TestRegionLoad.class);
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
private static Admin admin;
@ -65,18 +68,16 @@ public class TestRegionLoad {
@AfterClass
public static void afterClass() throws Exception {
for (TableName table : tables) {
UTIL.deleteTableIfAny(table);
}
UTIL.shutdownMiniCluster();
}
private static void createTables() throws IOException, InterruptedException {
byte[] FAMILY = Bytes.toBytes("f");
byte[][] FAMILIES = new byte [][] {Bytes.toBytes("f")};
for (TableName tableName : tables) {
Table table = UTIL.createMultiRegionTable(tableName, FAMILY, 16);
Table table =
UTIL.createTable(tableName, FAMILIES, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
UTIL.waitTableAvailable(tableName);
UTIL.loadTable(table, FAMILY);
UTIL.loadTable(table, FAMILIES[0]);
}
}
@ -87,8 +88,13 @@ public class TestRegionLoad {
for (ServerName serverName : admin
.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {
List<HRegionInfo> regions = admin.getOnlineRegions(serverName);
LOG.info("serverName=" + serverName + ", regions=" +
regions.stream().map(r -> r.getRegionNameAsString()).collect(Collectors.toList()));
Collection<RegionLoad> regionLoads = admin.getRegionMetrics(serverName)
.stream().map(r -> new RegionLoad(r)).collect(Collectors.toList());
LOG.info("serverName=" + serverName + ", regionLoads=" +
regionLoads.stream().map(r -> Bytes.toString(r.getRegionName())).
collect(Collectors.toList()));
checkRegionsAndRegionLoads(regions, regionLoads);
}
@ -115,6 +121,12 @@ public class TestRegionLoad {
(v1, v2) -> {
throw new RuntimeException("impossible!!");
}, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR)));
LOG.info("serverName=" + serverName + ", getRegionLoads=" +
serverLoad.getRegionsLoad().keySet().stream().map(r -> Bytes.toString(r)).
collect(Collectors.toList()));
LOG.info("serverName=" + serverName + ", regionLoads=" +
regionLoads.keySet().stream().map(r -> Bytes.toString(r)).
collect(Collectors.toList()));
compareRegionLoads(serverLoad.getRegionsLoad(), regionLoads);
}
}