Author: larsh Date: Mon Dec 24 02:09:51 2012 New Revision: 1425572 URL: http://svn.apache.org/viewvc?rev=1425572&view=rev Log: HBASE-7431 TestSplitTransactionOnCluster tests still flaky
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1425572&r1=1425571&r2=1425572&view=diff ============================================================================== --- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original) +++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Mon Dec 24 02:09:51 2012 @@ -1859,17 +1859,21 @@ public class HBaseTestingUtility extends 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; } Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java?rev=1425572&r1=1425571&r2=1425572&view=diff ============================================================================== --- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (original) +++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java Mon Dec 24 02:09:51 2012 @@ -543,7 +543,7 @@ public class TestSplitTransactionOnClust * @throws KeeperException */ @Test - public void testSplitBeforeSettingSplittingInZK() throws IOException, + public void testSplitBeforeSettingSplittingInZK() throws Exception, InterruptedException, KeeperException { testSplitBeforeSettingSplittingInZKInternals(); } @@ -727,8 +727,7 @@ public class TestSplitTransactionOnClust } - 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 TestSplitTransactionOnClust 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;