Repository: hbase
Updated Branches:
  refs/heads/master 593fb7508 -> 055dde7df


HBASE-16669 Fix flakey TestAdmin1#testMergeRegions

Has been failing with incorrect region counts


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/055dde7d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/055dde7d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/055dde7d

Branch: refs/heads/master
Commit: 055dde7dfc15ff3de66a78b621844ad6f8c68174
Parents: 593fb75
Author: Jonathan M Hsieh <jmhs...@apache.org>
Authored: Wed Sep 21 12:10:42 2016 -0700
Committer: Jonathan M Hsieh <jmhs...@apache.org>
Committed: Wed Sep 21 20:42:34 2016 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/client/TestAdmin1.java  | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/055dde7d/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
index b59a583..53dde73 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin1.java
@@ -30,6 +30,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.logging.Log;
@@ -1180,8 +1182,10 @@ public class TestAdmin1 {
     gotException = false;
     // Try merging a replica with another. Should fail.
     try {
+      // TODO convert this to version that is synchronous (See HBASE-16668)
       
TEST_UTIL.getAdmin().mergeRegionsAsync(regions.get(1).getFirst().getEncodedNameAsBytes(),
-          regions.get(2).getFirst().getEncodedNameAsBytes(), true);
+          regions.get(2).getFirst().getEncodedNameAsBytes(), true)
+          .get(60, TimeUnit.SECONDS);
     } catch (IllegalArgumentException m) {
       gotException = true;
     }
@@ -1358,7 +1362,7 @@ public class TestAdmin1 {
     }
   }
 
-  @Test
+  @Test (timeout=300000)
   public void testMergeRegions() throws Exception {
     TableName tableName = TableName.valueOf("testMergeWithFullRegionName");
     HColumnDescriptor cd = new HColumnDescriptor("d");
@@ -1380,17 +1384,21 @@ public class TestAdmin1 {
       assertEquals(3, admin.getTableRegions(tableName).size());
       regionA = tableRegions.get(0);
       regionB = tableRegions.get(1);
-      admin.mergeRegionsAsync(regionA.getRegionName(), 
regionB.getRegionName(), false);
-      Thread.sleep(1000);
+      // TODO convert this to version that is synchronous (See HBASE-16668)
+      admin.mergeRegionsAsync(regionA.getRegionName(), 
regionB.getRegionName(), false)
+          .get(60, TimeUnit.SECONDS);
+
       assertEquals(2, admin.getTableRegions(tableName).size());
 
       // merge with encoded name
       tableRegions = admin.getTableRegions(tableName);
       regionA = tableRegions.get(0);
       regionB = tableRegions.get(1);
+      // TODO convert this to version that is synchronous (See HBASE-16668)
       admin.mergeRegionsAsync(
-        regionA.getEncodedNameAsBytes(), regionB.getEncodedNameAsBytes(), 
false);
-      Thread.sleep(1000);
+        regionA.getEncodedNameAsBytes(), regionB.getEncodedNameAsBytes(), 
false)
+          .get(60, TimeUnit.SECONDS);
+
       assertEquals(1, admin.getTableRegions(tableName).size());
     } finally {
       this.admin.disableTable(tableName);

Reply via email to