Add wait on disable to complete to TestHFileOutputFormat by watching regions in transition...; seems to fix unit test

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1004474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-10-04 23:01:16 +00:00
parent 77dc443fc1
commit f363062641
1 changed files with 6 additions and 0 deletions

View File

@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Mapper;
@ -286,6 +287,11 @@ public class TestHFileOutputFormat {
if (shouldChangeRegions) { if (shouldChangeRegions) {
LOG.info("Changing regions in table"); LOG.info("Changing regions in table");
admin.disableTable(table.getTableName()); admin.disableTable(table.getTableName());
while(util.getMiniHBaseCluster().getMaster().getAssignmentManager().
isRegionsInTransition()) {
Threads.sleep(1000);
LOG.info("Waiting on table to finish disabling");
}
byte[][] newStartKeys = generateRandomStartKeys(15); byte[][] newStartKeys = generateRandomStartKeys(15);
util.createMultiRegions(util.getConfiguration(), util.createMultiRegions(util.getConfiguration(),
table, FAMILY_NAME, newStartKeys); table, FAMILY_NAME, newStartKeys);