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

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

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

Admin.getAlterStatus介绍

[英]Get the status of alter command - indicates how many regions have received the updated schema Asynchronous operation.
[中]获取alter命令的状态-指示有多少区域已接收到更新的架构异步操作。

代码示例

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

private void alterForPolicyTest(final MobCompactPartitionPolicy type)
  throws Exception {
 hcd1.setMobCompactPartitionPolicy(type);
 desc.modifyFamily(hcd1);
 admin.modifyTable(tableName, desc);
 Pair<Integer, Integer> st;
 while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
  LOG.debug(st.getFirst() + " regions left to update");
  Thread.sleep(40);
 }
 LOG.info("alter status finished");
}

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

/**
 * Modify a table, synchronous. Waiting logic similar to that of {@code admin.rb#alter_status}.
 */
@SuppressWarnings("serial")
public static void modifyTableSync(Admin admin, TableDescriptor desc)
  throws IOException, InterruptedException {
 admin.modifyTable(desc);
 Pair<Integer, Integer> status = new Pair<Integer, Integer>() {{
  setFirst(0);
  setSecond(0);
 }};
 int i = 0;
 do {
  status = admin.getAlterStatus(desc.getTableName());
  if (status.getSecond() != 0) {
   LOG.debug(status.getSecond() - status.getFirst() + "/" + status.getSecond()
    + " regions updated.");
   Thread.sleep(1 * 1000L);
  } else {
   LOG.debug("All regions updated.");
   break;
  }
 } while (status.getFirst() != 0 && i++ < 500);
 if (status.getFirst() != 0) {
  throw new IOException("Failed to update all regions even after 500 seconds.");
 }
}

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

admin.modifyTable(tableName, htd);
Pair<Integer, Integer> st;
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);
htd.modifyFamily(hcd);
admin.modifyTable(tableName, htd);
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);
htd.modifyFamily(hcd);
admin.modifyTable(tableName, htd);
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);

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

}};
for (int i = 0; status.getFirst() != 0 && i < 500; i++) {
 status = admin.getAlterStatus(desc.getTableName()); // co ModifyTableExample-5-Loop Loop over status until all regions are updated, or 500 seconds have been exceeded.
 if (status.getSecond() != 0) {
  int pending = status.getSecond() - status.getFirst();

代码示例来源:origin: locationtech/geowave

private void waitForUpdate(final Admin admin, final TableName tableName, final long sleepTimeMs) {
 try {
  while (admin.getAlterStatus(tableName).getFirst() > 0) {
   Thread.sleep(sleepTimeMs);
  }
 } catch (final Exception e) {
  LOGGER.error("Error waiting for table update", e);
 }
}

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

private void alterForPolicyTest(final MobCompactPartitionPolicy type)
  throws Exception {
 hcd1.setMobCompactPartitionPolicy(type);
 desc.modifyFamily(hcd1);
 admin.modifyTable(tableName, desc);
 Pair<Integer, Integer> st;
 while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
  LOG.debug(st.getFirst() + " regions left to update");
  Thread.sleep(40);
 }
 LOG.info("alter status finished");
}

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

/**
 * Modify a table, synchronous. Waiting logic similar to that of {@code admin.rb#alter_status}.
 */
@SuppressWarnings("serial")
public static void modifyTableSync(Admin admin, TableDescriptor desc)
  throws IOException, InterruptedException {
 admin.modifyTable(desc);
 Pair<Integer, Integer> status = new Pair<Integer, Integer>() {{
  setFirst(0);
  setSecond(0);
 }};
 int i = 0;
 do {
  status = admin.getAlterStatus(desc.getTableName());
  if (status.getSecond() != 0) {
   LOG.debug(status.getSecond() - status.getFirst() + "/" + status.getSecond()
    + " regions updated.");
   Thread.sleep(1 * 1000L);
  } else {
   LOG.debug("All regions updated.");
   break;
  }
 } while (status.getFirst() != 0 && i++ < 500);
 if (status.getFirst() != 0) {
  throw new IOException("Failed to update all regions even after 500 seconds.");
 }
}

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

admin.modifyTable(tableName, htd);
Pair<Integer, Integer> st;
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);
htd.modifyFamily(hcd);
admin.modifyTable(tableName, htd);
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);
htd.modifyFamily(hcd);
admin.modifyTable(tableName, htd);
while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
 LOG.debug(st.getFirst() + " regions left to update");
 Thread.sleep(40);

相关文章

Admin类方法