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 { throws IOException {
boolean startedServer = ensureSomeRegionServersAvailable(num); boolean startedServer = ensureSomeRegionServersAvailable(num);
int nonStoppedServers = 0;
for (JVMClusterUtil.RegionServerThread rst : for (JVMClusterUtil.RegionServerThread rst :
getMiniHBaseCluster().getRegionServerThreads()) { getMiniHBaseCluster().getRegionServerThreads()) {
HRegionServer hrs = rst.getRegionServer(); HRegionServer hrs = rst.getRegionServer();
if (hrs.isStopping() || hrs.isStopped()) { if (hrs.isStopping() || hrs.isStopped()) {
LOG.info("A region server is stopped or stopping:"+hrs); LOG.info("A region server is stopped or stopping:"+hrs);
} else {
nonStoppedServers++;
}
}
for (int i=nonStoppedServers; i<num; ++i) {
LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer()); LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer());
startedServer = true; startedServer = true;
} }
}
return startedServer; return startedServer;
} }

View File

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