HBASE-7597 TestHBaseFsck#testRegionShouldNotBeDeployed seems to be flaky
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1458059 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dce86001ea
commit
15c0385d4f
|
@ -1085,7 +1085,7 @@ public class TestHBaseFsck {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the region is not deployed when the table is disabled.
|
* The region is not deployed when the table is disabled.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRegionShouldNotBeDeployed() throws Exception {
|
public void testRegionShouldNotBeDeployed() throws Exception {
|
||||||
|
@ -1126,16 +1126,32 @@ public class TestHBaseFsck {
|
||||||
ZKTable zkTable = cluster.getMaster().getAssignmentManager().getZKTable();
|
ZKTable zkTable = cluster.getMaster().getAssignmentManager().getZKTable();
|
||||||
zkTable.setEnabledTable(table);
|
zkTable.setEnabledTable(table);
|
||||||
HRegionInfo region = disabledRegions.remove(0);
|
HRegionInfo region = disabledRegions.remove(0);
|
||||||
|
byte[] regionName = region.getRegionName();
|
||||||
|
|
||||||
|
// The region should not be assigned currently
|
||||||
|
assertTrue(cluster.getServerWith(regionName) == -1);
|
||||||
ZKAssign.createNodeOffline(zkw, region, serverName);
|
ZKAssign.createNodeOffline(zkw, region, serverName);
|
||||||
ProtobufUtil.openRegion(hrs, region);
|
ProtobufUtil.openRegion(hrs, region);
|
||||||
|
|
||||||
int iTimes = 0;
|
int iTimes = 0;
|
||||||
byte[] regionName = region.getRegionName();
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (cluster.getServerWith(regionName) != -1) {
|
if (cluster.getServerWith(regionName) != -1) {
|
||||||
// Now, region is deployed, reset the table state back
|
List<HRegionInfo> regions = ProtobufUtil.getOnlineRegions(hrs);
|
||||||
zkTable.setDisabledTable(table);
|
boolean found = false;
|
||||||
break;
|
for (HRegionInfo hri: regions) {
|
||||||
|
if (Bytes.equals(hri.getRegionName(), regionName)) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
LOG.info("Region was deployed but not in online " +
|
||||||
|
"region list. This should be transient. Waiting longer");
|
||||||
|
} else {
|
||||||
|
// Now, region is deployed, reset the table state back
|
||||||
|
zkTable.setDisabledTable(table);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
iTimes++;
|
iTimes++;
|
||||||
|
|
Loading…
Reference in New Issue