You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2012/12/24 03:10:15 UTC
svn commit: r1425573 - in
/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase:
HBaseTestingUtility.java regionserver/TestSplitTransactionOnCluster.java
Author: larsh
Date: Mon Dec 24 02:10:15 2012
New Revision: 1425573
URL: http://svn.apache.org/viewvc?rev=1425573&view=rev
Log:
HBASE-7431 TestSplitTransactionOnCluster tests still flaky
Modified:
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java?rev=1425573&r1=1425572&r2=1425573&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java Mon Dec 24 02:10:15 2012
@@ -1702,17 +1702,21 @@ public class HBaseTestingUtility {
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/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java?rev=1425573&r1=1425572&r2=1425573&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java Mon Dec 24 02:10:15 2012
@@ -539,14 +539,13 @@ public class TestSplitTransactionOnClust
* @throws KeeperException
*/
@Test
- public void testSplitBeforeSettingSplittingInZK() throws IOException,
+ public void testSplitBeforeSettingSplittingInZK() throws Exception,
InterruptedException, KeeperException {
testSplitBeforeSettingSplittingInZK(true);
testSplitBeforeSettingSplittingInZK(false);
}
- private void testSplitBeforeSettingSplittingInZK(boolean nodeCreated) throws IOException,
- KeeperException {
+ private void testSplitBeforeSettingSplittingInZK(boolean nodeCreated) throws Exception {
final byte[] tableName = Bytes.toBytes("testSplitBeforeSettingSplittingInZK");
HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
@@ -556,7 +555,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;
@@ -582,6 +586,8 @@ public class TestSplitTransactionOnClust
} catch (IOException e) {
String node = ZKAssign.getNodeName(regionServer.getZooKeeper(), regions.get(0)
.getRegionInfo().getEncodedName());
+ // make sure the client is uptodate
+ regionServer.getZooKeeper().sync(node);
if (nodeCreated) {
assertFalse(ZKUtil.checkExists(regionServer.getZooKeeper(), node) == -1);
} else {