Wait on compaction to finish; another attempt at fixing TestSplitTransactionOnCluster

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1125230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-05-20 04:37:32 +00:00
parent 55a7d35c2a
commit 5b4cb8c66b
1 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.executor.RegionTransitionData;
import org.apache.hadoop.hbase.master.handler.SplitRegionHandler;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NodeExistsException;
@ -386,6 +387,16 @@ public class TestSplitTransactionOnCluster {
// Compact first to ensure we have cleaned up references -- else the split
// will fail.
this.admin.compact(daughter.getRegionName());
daughters = cluster.getRegions(tableName);
HRegion daughterRegion = null;
for (HRegion r: daughters) {
if (r.getRegionInfo().equals(daughter)) daughterRegion = r;
}
assertTrue(daughterRegion != null);
while (true) {
if (!daughterRegion.hasReferences()) break;
Threads.sleep(100);
}
split(daughter, server, regionCount);
// Get list of daughters
daughters = cluster.getRegions(tableName);