HBASE-19840 Flakey TestMetaWithReplicas; ADDENDUM Adding debug

This commit is contained in:
Michael Stack 2018-02-05 11:00:46 -08:00
parent c245bd5c03
commit 9f2149f171
2 changed files with 21 additions and 3 deletions

View File

@ -22,6 +22,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.testclassification.SmallTests; import org.apache.hadoop.hbase.testclassification.SmallTests;
@ -38,6 +40,17 @@ public class TestServerName {
public static final HBaseClassTestRule CLASS_RULE = public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestServerName.class); HBaseClassTestRule.forClass(TestServerName.class);
@Test
public void testHash() {
ServerName sn1 = ServerName.parseServerName("asf903.gq1.ygridcore.net,52690,1517835491385");
ServerName sn2 = ServerName.parseServerName("asf903.gq1.ygridcore.net,42231,1517835491329");
Set<ServerName> sns = new HashSet<ServerName>();
sns.add(sn2);
sns.add(sn1);
sns.add(sn1);
assertEquals(2, sns.size());
}
@Test @Test
public void testGetHostNameMinusDomain() { public void testGetHostNameMinusDomain() {
assertEquals("2607:f0d0:1002:51::4", assertEquals("2607:f0d0:1002:51::4",

View File

@ -98,14 +98,19 @@ public class TestMetaWithReplicas {
TEST_UTIL.startMiniCluster(REGIONSERVERS_COUNT); TEST_UTIL.startMiniCluster(REGIONSERVERS_COUNT);
AssignmentManager am = TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager(); AssignmentManager am = TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager();
Set<ServerName> sns = new HashSet<ServerName>(); Set<ServerName> sns = new HashSet<ServerName>();
for (int replicaId = 0; replicaId < 3; replicaId ++) { ServerName hbaseMetaServerName =
TEST_UTIL.getMiniHBaseCluster().getMaster().getMetaTableLocator().
getMetaRegionLocation(TEST_UTIL.getZooKeeperWatcher());
LOG.info("HBASE:META DEPLOY: on " + hbaseMetaServerName);
sns.add(hbaseMetaServerName);
for (int replicaId = 1; replicaId < 3; replicaId ++) {
RegionInfo h = RegionInfo h =
RegionReplicaUtil.getRegionInfoForReplica(RegionInfoBuilder.FIRST_META_REGIONINFO, RegionReplicaUtil.getRegionInfoForReplica(RegionInfoBuilder.FIRST_META_REGIONINFO,
replicaId); replicaId);
try { try {
am.waitForAssignment(h); am.waitForAssignment(h);
ServerName sn = am.getRegionStates().getRegionServerOfRegion(h); ServerName sn = am.getRegionStates().getRegionServerOfRegion(h);
LOG.info(h.getRegionNameAsString() + " on " + sn); LOG.info("HBASE:META DEPLOY: " + h.getRegionNameAsString() + " on " + sn);
sns.add(sn); sns.add(sn);
} catch (NoSuchProcedureException e) { } catch (NoSuchProcedureException e) {
LOG.info("Presume the procedure has been cleaned up so just proceed: " + e.toString()); LOG.info("Presume the procedure has been cleaned up so just proceed: " + e.toString());
@ -116,7 +121,7 @@ public class TestMetaWithReplicas {
if (sns.size() == 1) { if (sns.size() == 1) {
int count = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size(); int count = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads().size();
assertTrue("count=" + count, count == REGIONSERVERS_COUNT); assertTrue("count=" + count, count == REGIONSERVERS_COUNT);
LOG.warn("All hbase:meta replicas are on the one server; moving hbase:meta"); LOG.warn("All hbase:meta replicas are on the one server; moving hbase:meta: " + sns);
int metaServerIndex = TEST_UTIL.getHBaseCluster().getServerWithMeta(); int metaServerIndex = TEST_UTIL.getHBaseCluster().getServerWithMeta();
int newServerIndex = metaServerIndex; int newServerIndex = metaServerIndex;
while (newServerIndex == metaServerIndex) { while (newServerIndex == metaServerIndex) {