From fb5883bea6ad58a3761998b995d9897d30983906 Mon Sep 17 00:00:00 2001 From: larsh Date: Mon, 24 Dec 2012 02:09:51 +0000 Subject: [PATCH] HBASE-7431 TestSplitTransactionOnCluster tests still flaky git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1425572 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/hadoop/hbase/HBaseTestingUtility.java | 10 +++++++--- .../regionserver/TestSplitTransactionOnCluster.java | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 7ead8fdc9f8..023ca3cec93 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -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 regions = cluster.getRegions(tableName); + List 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;