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

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

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

Admin.isTableAvailable介绍

暂无

代码示例

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

public static boolean isAccessControllerRunning(Connection connection)
  throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
 try (Admin admin = connection.getAdmin()) {
  return admin.isTableAvailable(ACL_TABLE_NAME);
 }
}

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

void modifyTableSync(Connection conn, TableDescriptor desc) throws IOException {
 try (Admin admin = conn.getAdmin()) {
  admin.modifyTable(desc);
  int attempt = 0;
  int maxAttempts = 600;
  while (!admin.isTableAvailable(desc.getTableName())) {
   Thread.sleep(100);
   attempt++;
   if (attempt++ > maxAttempts) {
    throw new IOException("Timeout expired " + (maxAttempts * 100) + "ms");
   }
  }
 } catch (Exception e) {
  throw new IOException(e);
 }
}

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

private void waitForSystemTable(Admin admin, TableName tableName) throws IOException {
 // Return fast if the table is available and avoid a log message
 if (admin.tableExists(tableName) && admin.isTableAvailable(tableName)) {
  return;
 }
 long TIMEOUT = 60000;
 long startTime = EnvironmentEdgeManager.currentTime();
 LOG.debug("Backup table {} is not present and available, waiting for it to become so",
   tableName);
 while (!admin.tableExists(tableName) || !admin.isTableAvailable(tableName)) {
  try {
   Thread.sleep(100);
  } catch (InterruptedException e) {
  }
  if (EnvironmentEdgeManager.currentTime() - startTime > TIMEOUT) {
   throw new IOException(
    "Failed to create backup system table " + tableName + " after " + TIMEOUT + "ms");
  }
 }
 LOG.debug("Backup table {} exists and available", tableName);
}

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

@Override
 public boolean evaluate() throws IOException {
  return admin.isTableAvailable(getTablename());
 }
});

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

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

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

@Override
public boolean isTableAvailableWithSplit(TTableName tableName, List<ByteBuffer> splitKeys)
  throws TIOError, TException {
 try {
  TableName table = tableNameFromThrift(tableName);
  byte[][] split = splitKeyFromThrift(splitKeys);
  return connectionCache.getAdmin().isTableAvailable(table, split);
 } catch (IOException e) {
  throw getTIOError(e);
 }
}

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

/** create a HTable that has the same performance settings as normal cube table, for benchmark purpose */
public static void createBenchmarkHTable(TableName tableName, String cfName) throws IOException {
  Admin admin = HBaseConnection.get(KylinConfig.getInstanceFromEnv().getStorageUrl()).getAdmin();
  try {
    if (admin.tableExists(tableName)) {
      logger.info("disabling hbase table " + tableName);
      admin.disableTable(tableName);
      logger.info("deleting hbase table " + tableName);
      admin.deleteTable(tableName);
    }
    HTableDescriptor tableDesc = new HTableDescriptor(tableName);
    tableDesc.setValue(HTableDescriptor.SPLIT_POLICY, DisabledRegionSplitPolicy.class.getName());
    KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv();
    tableDesc.addFamily(createColumnFamily(kylinConfig, cfName, false));
    logger.info("creating hbase table " + tableName);
    admin.createTable(tableDesc, null);
    Preconditions.checkArgument(admin.isTableAvailable(tableName), "table " + tableName + " created, but is not available due to some reasons");
    logger.info("create hbase table " + tableName + " done.");
  } finally {
    IOUtils.closeQuietly(admin);
  }
}

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

while (!admin.isTableAvailable(targetTableName)) {
 try {
  Thread.sleep(100);

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

RegionLocator regionLocator, boolean silence, boolean copyFile)
 throws TableNotFoundException, IOException {
if (!admin.isTableAvailable(regionLocator.getName())) {
 throw new TableNotFoundException("Table " + table.getName() + " is not currently available.");

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

@Test
public void testTableAvailableWithRandomSplitKeys() throws Exception {
 final TableName tableName = TableName.valueOf(name.getMethodName());
 HTableDescriptor desc = new HTableDescriptor(tableName);
 desc.addFamily(new HColumnDescriptor("col"));
 byte[][] splitKeys = new byte[1][];
 splitKeys = new byte [][] {
   new byte [] { 1, 1, 1 },
   new byte [] { 2, 2, 2 }
 };
 admin.createTable(desc);
 boolean tableAvailable = admin.isTableAvailable(tableName, splitKeys);
 assertFalse("Table should be created with 1 row in META", tableAvailable);
}

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

Table table, RegionLocator regionLocator, boolean silence, boolean copyFile)
 throws TableNotFoundException, IOException {
if (!admin.isTableAvailable(regionLocator.getName())) {
 throw new TableNotFoundException("Table " + table.getName() + " is not currently available.");

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

Preconditions.checkArgument(admin.isTableAvailable(TableName.valueOf(tableName)), "table " + tableName + " created, but is not available due to some reasons");
  logger.info("create hbase table " + tableName + " done.");
} finally {

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

assertTrue(admin.isTableAvailable(TABLENAME));

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

final TableName tableName = TableName.valueOf(name.getMethodName());
String peerId = "2";
if (admin2.isTableAvailable(TestReplicationBase.tableName)) {
 admin2.disableTable(TestReplicationBase.tableName);
 admin2.deleteTable(TestReplicationBase.tableName);
 admin2.isTableAvailable(TestReplicationBase.tableName));
 assertFalse("Table should not be created if user has set table cfs explicitly for the "
   + "peer and this is not part of that collection",
  admin2.isTableAvailable(TestReplicationBase.tableName));
 assertTrue(
  "Table should be created if user has explicitly added table into table cfs collection",
  admin2.isTableAvailable(TestReplicationBase.tableName));
} finally {
 adminExt.removePeerTableCFs(peerId, adminExt.getPeerTableCFs(peerId));

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

assertTrue(admin.isTableAvailable(TABLENAME));

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

hbaseAdmin.createTable(desc);
assertTrue(hbaseAdmin.isTableAvailable(tableName));

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

!admin.isTableAvailable(table.getName())) {
Thread.sleep(200);
LOG.info("Waiting for new region assignment to happen");

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

admin.isTableAvailable(tableName, splitKeys));
 assertEquals(NUM_REGIONS, TEST_UTIL.getHBaseCluster().getRegions(newTableName).size());
 assertTrue("New table should be created with splitKyes + 1 rows in META",
   admin.isTableAvailable(newTableName, splitKeys));
} else {
 assertEquals(1, TEST_UTIL.getHBaseCluster().getRegions(newTableName).size());

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

@Override
 public boolean evaluate() throws IOException {
  boolean tableAvailable = getAdmin().isTableAvailable(tableName);
  if (tableAvailable) {
   try (Table table = getConnection().getTable(tableName)) {
    TableDescriptor htd = table.getDescriptor();
    for (HRegionLocation loc : getConnection().getRegionLocator(tableName)
      .getAllRegionLocations()) {
     Scan scan = new Scan().withStartRow(loc.getRegionInfo().getStartKey())
       .withStopRow(loc.getRegionInfo().getEndKey()).setOneRowLimit()
       .setMaxResultsPerColumnFamily(1).setCacheBlocks(false);
     for (byte[] family : htd.getColumnFamilyNames()) {
      scan.addFamily(family);
     }
     try (ResultScanner scanner = table.getScanner(scan)) {
      scanner.next();
     }
    }
   }
  }
  return tableAvailable;
 }
};

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

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

相关文章

Admin类方法