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 2013/01/31 20:25:03 UTC
svn commit: r1441151 -
/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
Author: larsh
Date: Thu Jan 31 19:25:03 2013
New Revision: 1441151
URL: http://svn.apache.org/viewvc?rev=1441151&view=rev
Log:
HBASE-7717 addendum, really wait for all tables in TestSplitTransactionOnCluster.
Modified:
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/regionserver/TestSplitTransactionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java?rev=1441151&r1=1441150&r2=1441151&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 Thu Jan 31 19:25:03 2013
@@ -115,8 +115,7 @@ public class TestSplitTransactionOnClust
HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
try {
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, Bytes.toBytes("cf"));
-
+ HTable t = createTableAndWait(tableName, Bytes.toBytes("cf"));
final List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName());
@@ -200,8 +199,7 @@ public class TestSplitTransactionOnClust
Bytes.toBytes("ephemeral");
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -271,8 +269,7 @@ public class TestSplitTransactionOnClust
Bytes.toBytes("testExistingZnodeBlocksSplitAndWeRollback");
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -330,8 +327,7 @@ public class TestSplitTransactionOnClust
final byte [] tableName = Bytes.toBytes("testShutdownSimpleFixup");
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -383,8 +379,7 @@ public class TestSplitTransactionOnClust
Bytes.toBytes("testShutdownFixupWhenDaughterHasSplit");
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -459,8 +454,7 @@ public class TestSplitTransactionOnClust
final byte[] tableName = Bytes.toBytes("testMasterRestartWhenSplittingIsPartial");
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -537,8 +531,7 @@ public class TestSplitTransactionOnClust
// Create table then get the single region for our new table.
this.admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
- HTable t = TESTING_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
-
+ HTable t = createTableAndWait(tableName, HConstants.CATALOG_FAMILY);
List<HRegion> regions = cluster.getRegions(tableName);
HRegionInfo hri = getAndCheckSingleTableRegion(regions);
@@ -739,8 +732,7 @@ public class TestSplitTransactionOnClust
HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration());
try {
// Create table then get the single region for our new table.
- HTable t = TESTING_UTIL.createTable(tableName, Bytes.toBytes("cf"));
-
+ HTable t = createTableAndWait(tableName, Bytes.toBytes("cf"));
regions = cluster.getRegions(tableName);
int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName());
regionServer = cluster.getRegionServer(regionServerIndex);
@@ -1030,6 +1022,16 @@ public class TestSplitTransactionOnClust
}
}
+ private HTable createTableAndWait(byte[] tableName, byte[] cf) throws IOException,
+ InterruptedException {
+ HTable t = TESTING_UTIL.createTable(tableName, cf);
+ for (int i = 0; cluster.getRegions(tableName).size() == 0 && i < 100; i++) {
+ Thread.sleep(100);
+ }
+ assertTrue("Table not online: "+Bytes.toString(tableName), cluster.getRegions(tableName).size() != 0);
+ return t;
+ }
+
@org.junit.Rule
public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();