Repository: hbase
Updated Branches:
  refs/heads/master c7593d14a -> bc35de597


HBASE-20363 Addendum wait until region is splittable


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

Branch: refs/heads/master
Commit: bc35de597d07b41d7456a38fc2cb771c9292429a
Parents: c7593d1
Author: zhangduo <zhang...@apache.org>
Authored: Mon Apr 9 09:04:32 2018 +0800
Committer: zhangduo <zhang...@apache.org>
Committed: Mon Apr 9 09:07:06 2018 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/namespace/TestNamespaceAuditor.java      | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/bc35de59/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
index 40aba85..1b4957a 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java
@@ -361,8 +361,14 @@ public class TestNamespaceAuditor {
     hris = ADMIN.getRegions(tableTwo);
     assertEquals(initialRegions - 1, hris.size());
     Collections.sort(hris, RegionInfo.COMPARATOR);
-    UTIL.compact(tableTwo, true);
-    ADMIN.splitRegionAsync(hris.get(0).getRegionName(), 
Bytes.toBytes("3")).get(10,
+    byte[] splitKey = Bytes.toBytes("3");
+    HRegion regionToSplit = 
UTIL.getMiniHBaseCluster().getRegions(tableTwo).stream()
+      .filter(r -> r.getRegionInfo().containsRow(splitKey)).findFirst().get();
+    regionToSplit.compact(true);
+    // the above compact may quit immediately if there is a compaction 
ongoing, so here we need to
+    // wait a while to let the ongoing compaction finish.
+    UTIL.waitFor(10000, regionToSplit::isSplittable);
+    ADMIN.splitRegionAsync(regionToSplit.getRegionInfo().getRegionName(), 
splitKey).get(10,
       TimeUnit.SECONDS);
     hris = ADMIN.getRegions(tableTwo);
     assertEquals(initialRegions, hris.size());

Reply via email to