Skip to content

Commit

Permalink
HBASE-20363 Addendum wait until region is splittable
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Apr 9, 2018
1 parent c7593d1 commit bc35de5
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,14 @@ public void testRegionMerge() throws Exception {
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());
Expand Down

0 comments on commit bc35de5

Please sign in to comment.