Index: hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (revision 1440157) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (working copy) @@ -89,9 +89,9 @@ private MiniHBaseCluster cluster = null; private static final int NB_SERVERS = 2; private static CountDownLatch latch = new CountDownLatch(1); - private static boolean secondSplit = false; - private static boolean callRollBack = false; - private static boolean firstSplitCompleted = false; + private static volatile boolean secondSplit = false; + private static volatile boolean callRollBack = false; + private static volatile boolean firstSplitCompleted = false; private static final HBaseTestingUtility TESTING_UTIL = new HBaseTestingUtility(); @@ -198,6 +198,7 @@ SplitRegionHandler.TEST_SKIP = false; admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -249,6 +250,7 @@ } finally { admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -302,6 +304,7 @@ } finally { admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -373,6 +376,7 @@ } finally { admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -448,6 +452,7 @@ SplitRegionHandler.TEST_SKIP = false; admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -521,6 +526,7 @@ SplitRegionHandler.TEST_SKIP = false; this.admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); + t.close(); } } @@ -548,16 +554,7 @@ HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration()); try { // Create table then get the single region for our new table. - HTableDescriptor htd = new HTableDescriptor(tableName); - htd.addFamily(new HColumnDescriptor("cf")); - admin.createTable(htd); - HTable t = new HTable(cluster.getConfiguration(), tableName); - // wait for up to 10s - for (int i=0; cluster.getRegions(tableName).size() != 1 && i<100; i++) { - Thread.sleep(100); - } - assertTrue("waited too long for table to get online", - cluster.getRegions(tableName).size() == 1); + HTable t = TESTING_UTIL.createTable(tableName, Bytes.toBytes("cf")); final List regions = cluster.getRegions(tableName); HRegionInfo hri = getAndCheckSingleTableRegion(regions); int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName()); @@ -621,12 +618,12 @@ firstSplitCompleted = false; callRollBack = false; cluster.getMaster().setCatalogJanitorEnabled(true); - if (admin.isTableAvailable(tableName) && admin.isTableEnabled(tableName)) { - admin.disableTable(tableName); - admin.deleteTable(tableName); - admin.close(); - } } + if (admin.isTableAvailable(tableName) && admin.isTableEnabled(tableName)) { + admin.disableTable(tableName); + admin.deleteTable(tableName); + admin.close(); + } } @Test(timeout = 20000) @@ -638,10 +635,8 @@ HBaseAdmin admin = new HBaseAdmin(TESTING_UTIL.getConfiguration()); try { // Create table then get the single region for our new table. - HTableDescriptor htd = new HTableDescriptor(tableName); - htd.addFamily(new HColumnDescriptor("cf")); - admin.createTable(htd); - HTable t = new HTable(cluster.getConfiguration(), tableName); + HTable t = TESTING_UTIL.createTable(tableName, Bytes.toBytes("cf")); + regions = cluster.getRegions(tableName); int regionServerIndex = cluster.getServerWith(regions.get(0).getRegionName()); regionServer = cluster.getRegionServer(regionServerIndex);