/** * {@inheritDoc} */ @Override public void execute(Admin admin) { LOG.info("Executing splitting normalization plan: " + this); try { admin.splitRegion(regionInfo.getRegionName()); } catch (IOException ex) { LOG.error("Error during region split: ", ex); } } }
@Override public void perform() throws Exception { HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); Admin admin = util.getAdmin(); LOG.info("Performing action: Split random region of table " + tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName); if (regions == null || regions.isEmpty()) { LOG.info("Table " + tableName + " doesn't have regions to split"); return; } // Don't try the split if we're stopping if (context.isStopping()) { return; } HRegionInfo region = PolicyBasedChaosMonkey.selectRandomItem( regions.toArray(new HRegionInfo[regions.size()])); LOG.debug("Splitting region " + region.getRegionNameAsString()); try { admin.splitRegion(region.getRegionName()); } catch (Exception ex) { LOG.warn("Split failed, might be caused by other chaos: " + ex.getMessage()); } if (sleepTime > 0) { Thread.sleep(sleepTime); } } }
/** * Do a split, and verify that this only affects one table */ private void runTestRegionOperationsIndependent() throws Exception { // Verify that region information is the same pre-split ((ClusterConnection) UTIL.getConnection()).clearRegionCache(); List<HRegionInfo> originalTableHRegions = admin.getTableRegions(originalTableName); final int originalRegionCount = originalTableHRegions.size(); final int cloneTableRegionCount = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table is different than in the original table.", originalRegionCount, cloneTableRegionCount); // Split a region on the parent table admin.splitRegion(originalTableHRegions.get(0).getRegionName()); waitOnSplit(UTIL.getConnection(), originalTable, originalRegionCount); // Verify that the cloned table region is not split final int cloneTableRegionCount2 = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table changed though none of its regions were split.", cloneTableRegionCount, cloneTableRegionCount2); }
private List<HRegionLocation> splitRegion(final RegionInfo r) throws IOException, InterruptedException { List<HRegionLocation> locations = new ArrayList<>(); // Split this table in two. Admin admin = TEST_UTIL.getAdmin(); Connection connection = TEST_UTIL.getConnection(); admin.splitRegion(r.getEncodedNameAsBytes()); admin.close(); PairOfSameType<RegionInfo> regions = waitOnDaughters(r); if (regions != null) { try (RegionLocator rl = connection.getRegionLocator(r.getTable())) { locations.add(rl.getRegionLocation(regions.getFirst().getEncodedNameAsBytes())); locations.add(rl.getRegionLocation(regions.getSecond().getEncodedNameAsBytes())); } return locations; } return locations; }
admin.splitRegion(region.getRegionName(), splitPoint);
TEST_UTIL.getAdmin().splitRegion(regions.get(1).getFirst().getRegionName()); } catch (IllegalArgumentException ex) { gotException = true;
int numRegionsBeforeSplit = admin.getTableRegions(TEST_TABLE).size(); admin.splitRegion(admin.getTableRegions(TEST_TABLE).get(0).getEncodedNameAsBytes(), ROW_C); util.waitFor(20000, new Waiter.Predicate<Exception>() { @Override
admin.splitRegion(info.getRegionName()); // co ClusterOperationExample-04-Split Split the last region this table has, starting at row key "TUV". Adds a new region starting with key "WEI". do { list = admin.getTableRegions(tableName); System.out.println("Splitting region with wrong key: " + split.getRegionNameAsString()); admin.splitRegion(split.getRegionName(), Bytes.toBytes("ZZZ")); // triggers log message
/** * {@inheritDoc} */ @Override public void execute(Admin admin) { LOG.info("Executing splitting normalization plan: " + this); try { admin.splitRegion(regionInfo.getRegionName()); } catch (IOException ex) { LOG.error("Error during region split: ", ex); } } }
private void split(final RegionInfo hri, final HRegionServer server, final int regionCount) throws IOException, InterruptedException { admin.splitRegion(hri.getRegionName()); for (int i = 0; cluster.getRegions(hri.getTable()).size() <= regionCount && i < 60; i++) { LOG.debug("Waiting on region " + hri.getRegionNameAsString() + " to split"); Thread.sleep(2000); } assertFalse("Waited too long for split", cluster.getRegions(hri.getTable()).size() <= regionCount); }
@Override public void perform() throws Exception { HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility(); Admin admin = util.getAdmin(); LOG.info("Performing action: Split random region of table " + tableName); List<HRegionInfo> regions = admin.getTableRegions(tableName); if (regions == null || regions.isEmpty()) { LOG.info("Table " + tableName + " doesn't have regions to split"); return; } // Don't try the split if we're stopping if (context.isStopping()) { return; } HRegionInfo region = PolicyBasedChaosMonkey.selectRandomItem( regions.toArray(new HRegionInfo[regions.size()])); LOG.debug("Splitting region " + region.getRegionNameAsString()); try { admin.splitRegion(region.getRegionName()); } catch (Exception ex) { LOG.warn("Split failed, might be caused by other chaos: " + ex.getMessage()); } if (sleepTime > 0) { Thread.sleep(sleepTime); } } }
/** * Do a split, and verify that this only affects one table */ private void runTestRegionOperationsIndependent() throws Exception { // Verify that region information is the same pre-split ((ClusterConnection) UTIL.getConnection()).clearRegionCache(); List<HRegionInfo> originalTableHRegions = admin.getTableRegions(originalTableName); final int originalRegionCount = originalTableHRegions.size(); final int cloneTableRegionCount = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table is different than in the original table.", originalRegionCount, cloneTableRegionCount); // Split a region on the parent table admin.splitRegion(originalTableHRegions.get(0).getRegionName()); waitOnSplit(UTIL.getConnection(), originalTable, originalRegionCount); // Verify that the cloned table region is not split final int cloneTableRegionCount2 = admin.getTableRegions(cloneTableName).size(); Assert.assertEquals( "The number of regions in the cloned table changed though none of its regions were split.", cloneTableRegionCount, cloneTableRegionCount2); }
table.put(p); admin.flush(userTableName); admin.splitRegion(hRegionInfo.getRegionName(), "row7".getBytes()); regionsOfTable = cluster.getMaster() .getAssignmentManager().getRegionStates()
private List<HRegionLocation> splitRegion(final RegionInfo r) throws IOException, InterruptedException { List<HRegionLocation> locations = new ArrayList<>(); // Split this table in two. Admin admin = TEST_UTIL.getAdmin(); Connection connection = TEST_UTIL.getConnection(); admin.splitRegion(r.getEncodedNameAsBytes()); admin.close(); PairOfSameType<RegionInfo> regions = waitOnDaughters(r); if (regions != null) { try (RegionLocator rl = connection.getRegionLocator(r.getTable())) { locations.add(rl.getRegionLocation(regions.getFirst().getEncodedNameAsBytes())); locations.add(rl.getRegionLocation(regions.getSecond().getEncodedNameAsBytes())); } return locations; } return locations; }
admin.splitRegion(region.getRegionName(), splitPoint);
TEST_UTIL.getAdmin().splitRegion(regions.get(1).getFirst().getRegionName()); } catch (IllegalArgumentException ex) { gotException = true;
int numRegionsBeforeSplit = admin.getTableRegions(TEST_TABLE).size(); admin.splitRegion(admin.getTableRegions(TEST_TABLE).get(0).getEncodedNameAsBytes(), ROW_C); util.waitFor(20000, new Waiter.Predicate<Exception>() { @Override
this.admin.splitRegion(hri.getRegionName()); fail(); } catch (DoNotRetryRegionException e) {
this.admin.splitRegion(region.getRegionInfo().getRegionName(), new byte[] {42});
printOutRegions(server, "Initial regions: "); this.admin.splitRegion(hri.getRegionName()); List<HRegion> daughters = checkAndGetDaughters(tableName);