HBASE-19837 Flakey TestRegionLoad
Add debug, change name of the rows so readable.
This commit is contained in:
parent
c1470714bb
commit
b44be75bd1
|
@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.client.Table;
|
||||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.MiscTests;
|
import org.apache.hadoop.hbase.testclassification.MiscTests;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
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.Lists;
|
||||||
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
|
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Category({MiscTests.class, MediumTests.class})
|
@Category({MiscTests.class, MediumTests.class})
|
||||||
public class TestRegionLoad {
|
public class TestRegionLoad {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(TestRegionLoad.class);
|
||||||
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
|
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
|
||||||
private static Admin admin;
|
private static Admin admin;
|
||||||
|
|
||||||
|
@ -65,18 +68,16 @@ public class TestRegionLoad {
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws Exception {
|
public static void afterClass() throws Exception {
|
||||||
for (TableName table : tables) {
|
|
||||||
UTIL.deleteTableIfAny(table);
|
|
||||||
}
|
|
||||||
UTIL.shutdownMiniCluster();
|
UTIL.shutdownMiniCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createTables() throws IOException, InterruptedException {
|
private static void createTables() throws IOException, InterruptedException {
|
||||||
byte[] FAMILY = Bytes.toBytes("f");
|
byte[][] FAMILIES = new byte [][] {Bytes.toBytes("f")};
|
||||||
for (TableName tableName : tables) {
|
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.waitTableAvailable(tableName);
|
||||||
UTIL.loadTable(table, FAMILY);
|
UTIL.loadTable(table, FAMILIES[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +88,13 @@ public class TestRegionLoad {
|
||||||
for (ServerName serverName : admin
|
for (ServerName serverName : admin
|
||||||
.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {
|
.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {
|
||||||
List<HRegionInfo> regions = admin.getOnlineRegions(serverName);
|
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)
|
Collection<RegionLoad> regionLoads = admin.getRegionMetrics(serverName)
|
||||||
.stream().map(r -> new RegionLoad(r)).collect(Collectors.toList());
|
.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);
|
checkRegionsAndRegionLoads(regions, regionLoads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +121,12 @@ public class TestRegionLoad {
|
||||||
(v1, v2) -> {
|
(v1, v2) -> {
|
||||||
throw new RuntimeException("impossible!!");
|
throw new RuntimeException("impossible!!");
|
||||||
}, () -> new TreeMap<>(Bytes.BYTES_COMPARATOR)));
|
}, () -> 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);
|
compareRegionLoads(serverLoad.getRegionsLoad(), regionLoads);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue