From 4214c2f80a34ad6932ef29702f9d94980c5d1be1 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sun, 21 Jan 2018 23:03:16 -0800 Subject: [PATCH] HBASE-19837 Flakey TestRegionLoad Add debug, change name of the rows so readable. --- .../apache/hadoop/hbase/protobuf/ProtobufUtil.java | 2 +- .../org/apache/hadoop/hbase/TestRegionLoad.java | 26 ++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index fd263b02f3..eed911a5d9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -260,7 +260,7 @@ public final class ProtobufUtil { * Return the Exception thrown by the remote server wrapped in * ServiceException as cause. RemoteException are left untouched. * - * @param se ServiceException that wraps IO exception thrown by the server + * @param e ServiceException that wraps IO exception thrown by the server * @return Exception wrapped in ServiceException. */ public static IOException getServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException e) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java index c1dab389d9..9712b9e951 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java @@ -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 regions = admin.getOnlineRegions(serverName); + LOG.info("serverName=" + serverName + ", regions=" + + regions.stream().map(r -> r.getRegionNameAsString()).collect(Collectors.toList())); Collection 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); } } -- 2.11.0 (Apple Git-81)