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

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

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

Admin.isTableDisabled介绍

暂无

代码示例

代码示例来源:origin: thinkaurelius/titan

@Override
public boolean isTableDisabled(String tableString) throws IOException
{
  return adm.isTableDisabled(TableName.valueOf(tableString));
}

代码示例来源:origin: thinkaurelius/titan

@Override
public void clearTable(String tableString, long timestamp) throws IOException
{
  TableName tableName = TableName.valueOf(tableString);
  if (!adm.tableExists(tableName)) {
    log.debug("Attempted to clear table {} before it exists (noop)", tableString);
    return;
  }
  if (!adm.isTableDisabled(tableName))
    adm.disableTable(tableName);
  if (!adm.isTableDisabled(tableName))
    throw new RuntimeException("Unable to disable table " + tableName);
  // This API call appears to both truncate and reenable the table.
  log.info("Truncating table {}", tableName);
  adm.truncateTable(tableName, true /* preserve splits */);
  try {
    adm.enableTable(tableName);
  } catch (TableNotDisabledException e) {
    // This triggers seemingly every time in testing with 1.0.2.
    log.debug("Table automatically reenabled by truncation: {}", tableName, e);
  }
}

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

if (admin.tableExists(tableName)) {
 existTableList.add(tableName);
 if (admin.isTableDisabled(tableName)) {
  disabledTableList.add(tableName);

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

@Override
 public boolean evaluate() throws IOException {
  return getAdmin().isTableDisabled(tableName);
 }
};

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

@Override
public boolean isTableDisabled(TTableName tableName) throws TIOError, TException {
 try {
  TableName table = tableNameFromThrift(tableName);
  return connectionCache.getAdmin().isTableDisabled(table);
 } catch (IOException e) {
  throw getTIOError(e);
 }
}

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

@Test
public void testIsEnabledOrDisabledOnUnknownTable() throws Exception {
 try {
  admin.isTableEnabled(TableName.valueOf(name.getMethodName()));
  fail("Test should fail if isTableEnabled called on unknown table.");
 } catch (IOException e) {
 }
 try {
  admin.isTableDisabled(TableName.valueOf(name.getMethodName()));
  fail("Test should fail if isTableDisabled called on unknown table.");
 } catch (IOException e) {
 }
}

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

protected void deleteTable() throws Exception {
 if (util.getAdmin().tableExists(TABLE_NAME)) {
  LOG.info("Deleting table");
  if (!util.getAdmin().isTableDisabled(TABLE_NAME)) {
   util.getAdmin().disableTable(TABLE_NAME);
  }
  util.getAdmin().deleteTable(TABLE_NAME);
  LOG.info("Deleted table");
 }
}

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

admin.disableTable(tableName);
Assert.assertTrue("Table: " + selected + " was not disabled",
  admin.isTableDisabled(tableName));
TableDescriptor freshTableDesc = admin.getDescriptor(tableName);
Assert.assertTrue(
 "After disable, Table: " + tableName + " is not disabled",
 admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Disabled table :" + freshTableDesc);

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

protected void verifyTables() throws  IOException{
 Connection connection = getConnection();
 Admin admin = connection.getAdmin();
 // iterating concurrent map
 for (TableName tableName : enabledTables.keySet()){
  Assert.assertTrue("Table: " + tableName + " in enabledTables is not enabled",
    admin.isTableEnabled(tableName));
 }
 for (TableName tableName : disabledTables.keySet()){
  Assert.assertTrue("Table: " + tableName + " in disabledTables is not disabled",
    admin.isTableDisabled(tableName));
 }
 for (TableName tableName : deletedTables.keySet()){
  Assert.assertFalse("Table: " + tableName + " in deletedTables is not deleted",
    admin.tableExists(tableName));
 }
 admin.close();
}

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

/**
 * Truncate a table using the admin command.
 * Effectively disables, deletes, and recreates the table.
 * @param tableName table which must exist.
 * @param preserveRegions keep the existing split points
 * @return HTable for the new table
 */
public Table truncateTable(final TableName tableName, final boolean preserveRegions) throws
  IOException {
 Admin admin = getAdmin();
 if (!admin.isTableDisabled(tableName)) {
  admin.disableTable(tableName);
 }
 admin.truncateTable(tableName, preserveRegions);
 return getConnection().getTable(tableName);
}

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

Assert.assertTrue(
 "After add column family, Table: " + tableName + " is not disabled",
 admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Added column family: " + cfd + " to table: " + tableName);

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

Assert.assertTrue(
 "After delete column family, Table: " + tableName + " is not disabled",
 admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Deleted column family: " + cfd + " from table: " + tableName);

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

private void runRestoreWithAdditionalMetadata(boolean changeMetadata, boolean addData)
  throws Exception {
 if (admin.isTableDisabled(originalTableName)) {
  admin.enableTable(originalTableName);
 if (!admin.isTableDisabled(originalTableName)) {
  admin.disableTable(originalTableName);

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

private void cleanBackupTable() throws IOException {
 Admin admin = UTIL.getHBaseAdmin();
 admin.disableTable(BackupSystemTable.getTableName(conf));
 admin.truncateTable(BackupSystemTable.getTableName(conf), true);
 if (admin.isTableDisabled(BackupSystemTable.getTableName(conf))) {
  admin.enableTable(BackupSystemTable.getTableName(conf));
 }
}

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

assert(i != max);
TEST_UTIL.getAdmin().disableTable(tableName);
assertTrue(TEST_UTIL.getAdmin().isTableDisabled(tableName));

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

Assert.assertTrue(
 "After alter encoding of column family, Table: " + tableName + " is not disabled",
 admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Altered encoding of column family: " + freshColumnDesc + " to: " + id +

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

Assert.assertTrue(
 "After alter versions of column family, Table: " + tableName + " is not disabled",
 admin.isTableDisabled(tableName));
disabledTables.put(tableName, freshTableDesc);
LOG.info("Altered versions of column family: " + columnDesc + " to: " + versions +

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

assertTrue(admin.isTableDisabled(tableName));
  cp.wasRestoreSnapshotCalled());
 admin.disableTable(TEST_CLONE);
 assertTrue(admin.isTableDisabled(tableName));
 deleteTable(admin, TEST_CLONE);

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

assertEquals("value-" + i, nd.getConfigurationValue("key-" + i));
UTIL.waitFor(30000, () -> UTIL.getAdmin().isTableDisabled(TableName.NAMESPACE_TABLE_NAME));

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

assertTrue(admin.isTableDisabled(tableDescriptor.getTableName()));

相关文章

Admin类方法