HBASE-7431 TestSplitTransactionOnCluster tests still flaky

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1425572 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2012-12-24 02:09:51 +00:00
parent 17ab8864c6
commit fb5883bea6
2 changed files with 15 additions and 7 deletions

View File

@ -1859,17 +1859,21 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
throws IOException {
boolean startedServer = ensureSomeRegionServersAvailable(num);
int nonStoppedServers = 0;
for (JVMClusterUtil.RegionServerThread rst :
getMiniHBaseCluster().getRegionServerThreads()) {
HRegionServer hrs = rst.getRegionServer();
if (hrs.isStopping() || hrs.isStopped()) {
LOG.info("A region server is stopped or stopping:"+hrs);
LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer());
startedServer = true;
} else {
nonStoppedServers++;
}
}
for (int i=nonStoppedServers; i<num; ++i) {
LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer());
startedServer = true;
}
return startedServer;
}

View File

@ -543,7 +543,7 @@ public class TestSplitTransactionOnCluster {
* @throws KeeperException
*/
@Test
public void testSplitBeforeSettingSplittingInZK() throws IOException,
public void testSplitBeforeSettingSplittingInZK() throws Exception,
InterruptedException, KeeperException {
testSplitBeforeSettingSplittingInZKInternals();
}
@ -727,8 +727,7 @@ public class TestSplitTransactionOnCluster {
}
private void testSplitBeforeSettingSplittingInZKInternals() throws IOException,
KeeperException {
private void testSplitBeforeSettingSplittingInZKInternals() throws Exception {
final byte[] tableName = Bytes.toBytes("testSplitBeforeSettingSplittingInZK");
HBaseAdmin admin = TESTING_UTIL.getHBaseAdmin();
try {
@ -737,7 +736,12 @@ public class TestSplitTransactionOnCluster {
htd.addFamily(new HColumnDescriptor("cf"));
admin.createTable(htd);
List<HRegion> regions = cluster.getRegions(tableName);
List<HRegion> regions = null;
for (int i=0; i<100; i++) {
regions = cluster.getRegions(tableName);
if (regions.size() > 0) break;
Thread.sleep(100);
}
int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName());
HRegionServer regionServer = cluster.getRegionServer(regionServerIndex);
SplitTransaction st = null;