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

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

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

Admin.listTableDescriptors介绍

[英]List all the userspace tables.
[中]列出所有用户空间表。

代码示例

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

TableDescriptor[] getTableDescriptors(List<TableName> tableNames) {
  LOG.info("getTableDescriptors == tableNames => " + tableNames);
 try (Connection conn = ConnectionFactory.createConnection(getConf());
   Admin admin = conn.getAdmin()) {
  List<TableDescriptor> tds = admin.listTableDescriptors(tableNames);
  return tds.toArray(new TableDescriptor[tds.size()]);
 } catch (IOException e) {
  LOG.debug("Exception getting table descriptors", e);
 }
 return new TableDescriptor[0];
}

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

@Override
public List<TTableDescriptor> getTableDescriptorsByPattern(String regex, boolean includeSysTables)
  throws TIOError, TException {
 try {
  Pattern pattern = (regex == null ? null : Pattern.compile(regex));
  List<TableDescriptor> tableDescriptors = connectionCache.getAdmin()
    .listTableDescriptors(pattern, includeSysTables);
  return tableDescriptorsFromHBase(tableDescriptors);
 } catch (IOException e) {
  throw getTIOError(e);
 }
}

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

@Override
public List<TTableDescriptor> getTableDescriptors(List<TTableName> tables)
  throws TIOError, TException {
 try {
  List<TableName> tableNames = ThriftUtilities.tableNamesFromThrift(tables);
  List<TableDescriptor> tableDescriptors = connectionCache.getAdmin()
    .listTableDescriptors(tableNames);
  return tableDescriptorsFromHBase(tableDescriptors);
 } catch (IOException e) {
  throw getTIOError(e);
 }
}

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

private List<Future<Void>> sniff(TaskType taskType, RegionStdOutSink regionSink)
  throws Exception {
 LOG.debug("Reading list of tables");
 List<Future<Void>> taskFutures = new LinkedList<>();
 for (TableDescriptor td: admin.listTableDescriptors()) {
  if (admin.isTableEnabled(td.getTableName()) &&
    (!td.getTableName().equals(writeTableName))) {
   LongAdder readLatency =
     regionSink.initializeAndGetReadLatencyForTable(td.getTableName().getNameAsString());
   taskFutures.addAll(Canary.sniff(admin, sink, td, executor, taskType, this.rawScanEnabled,
     readLatency));
  }
 }
 return taskFutures;
}

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

try {
 LOG.debug("Reading list of tables and locations");
 List<TableDescriptor> tableDescs = this.admin.listTableDescriptors();
 List<RegionInfo> regions = null;
 for (TableDescriptor tableDesc: tableDescs) {

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

@VisibleForTesting
protected void validateTables(ClassLoader classLoader, Admin admin,
  Pattern pattern, List<CoprocessorViolation> violations) throws IOException {
 List<TableDescriptor> tableDescriptors = admin.listTableDescriptors(pattern);
 for (TableDescriptor tableDescriptor : tableDescriptors) {
  LOG.debug("Validating table {}", tableDescriptor.getTableName());
  Collection<CoprocessorDescriptor> coprocessorDescriptors =
    tableDescriptor.getCoprocessorDescriptors();
  for (CoprocessorDescriptor coprocessorDescriptor : coprocessorDescriptors) {
   String className = coprocessorDescriptor.getClassName();
   Optional<String> jarPath = coprocessorDescriptor.getJarPath();
   if (jarPath.isPresent()) {
    org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(jarPath.get());
    try (ResolverUrlClassLoader cpClassLoader = createClassLoader(classLoader, path)) {
     validate(cpClassLoader, className, violations);
    } catch (IOException e) {
     CoprocessorViolation violation = new CoprocessorViolation(
       className, Severity.ERROR,
       "could not validate jar file '" + path + "'", e);
     violations.add(violation);
    }
   } else {
    validate(classLoader, className, violations);
   }
  }
 }
}

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

List<TableDescriptor> tableDescriptors = admin.listTableDescriptors();
String encoding = "";

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

public void deleteTableIfNecessary() throws IOException {
 for (TableDescriptor desc : TEST_UTIL.getAdmin()
  .listTableDescriptors(Pattern.compile(tablePrefix + ".*"))) {
  TEST_UTIL.deleteTable(desc.getTableName());
 }
}

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

private List<CoprocessorViolation> validateTable(String jarFile, String className)
  throws IOException {
 Pattern pattern = Pattern.compile(".*");
 Admin admin = mock(Admin.class);
 TableDescriptor tableDescriptor = mock(TableDescriptor.class);
 List<TableDescriptor> tableDescriptors = Lists.newArrayList(tableDescriptor);
 doReturn(tableDescriptors).when(admin).listTableDescriptors(pattern);
 CoprocessorDescriptor coprocessorDescriptor = mock(CoprocessorDescriptor.class);
 List<CoprocessorDescriptor> coprocessorDescriptors =
   Lists.newArrayList(coprocessorDescriptor);
 doReturn(coprocessorDescriptors).when(tableDescriptor).getCoprocessorDescriptors();
 doReturn(getFullClassName(className)).when(coprocessorDescriptor).getClassName();
 doReturn(Optional.ofNullable(jarFile)).when(coprocessorDescriptor).getJarPath();
 List<CoprocessorViolation> violations = new ArrayList<>();
 validator.validateTables(getClassLoader(), admin, pattern, violations);
 return violations;
}

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

@After
public void tearDown() throws Exception {
 for (TableDescriptor htd: UTIL.getAdmin().listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 for (TableDescriptor htd : TEST_UTIL.getAdmin().listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  TEST_UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 for (TableDescriptor htd : TEST_UTIL.getAdmin().listTableDescriptors()) {
  TEST_UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 this.admin.close();
 for (TableDescriptor htd: this.admin.listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  TESTING_UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 resetProcExecutorTestingKillFlag();
 for (TableDescriptor htd: admin.listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 for (TableDescriptor td: UTIL.getAdmin().listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + td.getTableName());
  UTIL.deleteTable(td.getTableName());
 }
 // Turn on balancer
 admin.setBalancerRunning(true, false);
}

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

@After
public void tearDown() throws Exception {
 ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
 for (TableDescriptor htd: UTIL.getAdmin().listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
 for (TableDescriptor htd: UTIL.getAdmin().listTableDescriptors()) {
  LOG.info("Tear down, remove table=" + htd.getTableName());
  UTIL.deleteTable(htd.getTableName());
 }
}

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

@After
public void tearDown() throws Exception {
 ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(getMasterProcedureExecutor(), false);
 for (TableDescriptor htd : UTIL.getAdmin().listTableDescriptors()) {
  UTIL.deleteTable(htd.getTableName());
 }
}

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

@Test
public void testMasterSwitch() throws Exception {
 // get an admin instance and issue some request first
 Connection conn = TEST_UTIL.getConnection();
 Admin admin = conn.getAdmin();
 LOG.debug("Tables: " + admin.listTableDescriptors());
 try {
  MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
  // switch active master
  HMaster master = cluster.getMaster();
  master.stopMaster();
  while (!master.isShutDown()) {
   Thread.sleep(200);
  }
  while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) {
   Thread.sleep(200);
  }
  // confirm client access still works
  Assert.assertTrue(admin.balance(false));
 } finally {
  admin.close();
 }
}

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

throws SQLException, IOException {
  Set<TableDescriptor> tableDescriptorsToSynchronize = new HashSet<>();
  for (TableDescriptor origTableDesc : admin.listTableDescriptors()) {
    if (MetaDataUtil.isViewIndex(origTableDesc.getTableName().getNameWithNamespaceInclAsString())) {

相关文章

Admin类方法