org.apache.hadoop.hbase.client.Admin.splitRegion()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.apache.hadoop.hbase.client.Admin.splitRegion()方法的一些代码示例,展示了Admin.splitRegion()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.splitRegion()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:splitRegion

Admin.splitRegion介绍

[英]Split an individual region. Asynchronous operation.
[中]分割单个区域。异步操作。

代码示例

代码示例来源:origin: apache/hbase

/**
  * {@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);
  }
 }
}

代码示例来源:origin: apache/hbase

@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);
  }
 }
}

代码示例来源:origin: apache/hbase

/**
 * 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);
}

代码示例来源:origin: apache/hbase

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;
}

代码示例来源:origin: apache/hbase

admin.splitRegion(region.getRegionName(), splitPoint);

代码示例来源:origin: apache/hbase

TEST_UTIL.getAdmin().splitRegion(regions.get(1).getFirst().getRegionName());
} catch (IllegalArgumentException ex) {
 gotException = true;

代码示例来源:origin: apache/hbase

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

代码示例来源:origin: larsgeorge/hbase-book

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

代码示例来源:origin: harbby/presto-connectors

/**
  * {@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);
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

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);
}

代码示例来源:origin: org.apache.hbase/hbase-it

@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);
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

/**
 * 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);
}

代码示例来源:origin: org.apache.hbase/hbase-server

table.put(p);
admin.flush(userTableName);
admin.splitRegion(hRegionInfo.getRegionName(), "row7".getBytes());
regionsOfTable = cluster.getMaster()
  .getAssignmentManager().getRegionStates()

代码示例来源:origin: org.apache.hbase/hbase-server

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;
}

代码示例来源:origin: org.apache.hbase/hbase-server

admin.splitRegion(region.getRegionName(), splitPoint);

代码示例来源:origin: org.apache.hbase/hbase-server

TEST_UTIL.getAdmin().splitRegion(regions.get(1).getFirst().getRegionName());
} catch (IllegalArgumentException ex) {
 gotException = true;

代码示例来源:origin: org.apache.hbase/hbase-server

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

代码示例来源:origin: org.apache.hbase/hbase-server

this.admin.splitRegion(hri.getRegionName());
 fail();
} catch (DoNotRetryRegionException e) {

代码示例来源:origin: org.apache.hbase/hbase-server

this.admin.splitRegion(region.getRegionInfo().getRegionName(), new byte[] {42});

代码示例来源:origin: org.apache.hbase/hbase-server

printOutRegions(server, "Initial regions: ");
this.admin.splitRegion(hri.getRegionName());
List<HRegion> daughters = checkAndGetDaughters(tableName);

相关文章

Admin类方法