本文整理了Java中org.apache.hadoop.hbase.client.Admin.tableExists()
方法的一些代码示例,展示了Admin.tableExists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Admin.tableExists()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Admin
类名称:Admin
方法名:tableExists
暂无
代码示例来源:origin: thinkaurelius/titan
@Override
public boolean tableExists(String tableString) throws IOException
{
return adm.tableExists(TableName.valueOf(tableString));
}
代码示例来源:origin: apache/hbase
protected boolean tableExists(TableName table, Connection conn) throws IOException {
try (Admin admin = conn.getAdmin()) {
return admin.tableExists(table);
}
}
代码示例来源:origin: apache/hbase
public static boolean isSecurityAvailable(Configuration conf) throws IOException {
try (Connection conn = ConnectionFactory.createConnection(conf)) {
try (Admin admin = conn.getAdmin()) {
return admin.tableExists(AccessControlLists.ACL_TABLE_NAME);
}
}
}
代码示例来源:origin: apache/hbase
@Override
public boolean evaluate() throws IOException {
return conn.getAdmin().tableExists(QuotaUtil.QUOTA_TABLE_NAME);
}
});
代码示例来源:origin: apache/hbase
@Override
public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx)
throws IOException {
try (Admin admin = ctx.getEnvironment().getConnection().getAdmin()) {
if (!admin.tableExists(AccessControlLists.ACL_TABLE_NAME)) {
createACLTable(admin);
} else {
this.aclTabAvailable = true;
}
}
}
/**
代码示例来源:origin: apache/hbase
private void deleteTable() throws Exception {
if (util.getAdmin().tableExists(TABLE_NAME)) {
LOG.info("Deleting table");
util.deleteTable(TABLE_NAME);
LOG.info("Deleted table");
}
}
代码示例来源:origin: apache/hbase
@Before
public void beforeMethod() throws Exception {
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
TEST_UTIL.deleteTable(TABLE_NAME);
}
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
htd.addFamily(new HColumnDescriptor(CFA));
htd.addFamily(new HColumnDescriptor(CFB));
admin.createTable(htd);
}
代码示例来源:origin: apache/hbase
@Test
public void testTableExist() throws IOException {
final TableName table = TableName.valueOf(name.getMethodName());
boolean exist;
exist = this.admin.tableExists(table);
assertEquals(false, exist);
TEST_UTIL.createTable(table, HConstants.CATALOG_FAMILY);
exist = this.admin.tableExists(table);
assertEquals(true, exist);
}
代码示例来源:origin: apache/hbase
protected static Table openTable(TableName tableName) throws IOException {
Table table = TEST_UTIL.getConnection().getTable(tableName);
assertTrue("Fail to create the table", admin.tableExists(tableName));
return table;
}
代码示例来源:origin: apache/hbase
@Test
public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception {
admin1.disableTableReplication(tableName);
admin2.disableTable(tableName);
admin2.deleteTable(tableName);
assertFalse(admin2.tableExists(tableName));
admin1.enableTableReplication(tableName);
assertTrue(admin2.tableExists(tableName));
}
代码示例来源:origin: apache/hbase
private void deleteTableIfNecessary() throws IOException {
if (util.getAdmin().tableExists(getTablename())) {
util.deleteTable(getTablename());
}
}
代码示例来源:origin: apache/hbase
@Test
public void testDisableTableReplication() throws Exception {
admin.disableTableRep(tableName);
assertTrue(utility2.getAdmin().tableExists(tableName));
}
}
代码示例来源:origin: apache/hbase
@After
public void tearDown() throws Exception {
if (admin.tableExists(tableName)) {
TEST_UTIL.deleteTable(tableName);
}
SnapshotTestingUtils.deleteAllSnapshots(admin);
SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL);
}
}
代码示例来源:origin: apache/hbase
@Test
public void createTableInSystemNamespace() throws Exception {
final TableName tableName = TableName.valueOf("hbase:" + name.getMethodName());
HTableDescriptor desc = new HTableDescriptor(tableName);
HColumnDescriptor colDesc = new HColumnDescriptor("cf1");
desc.addFamily(colDesc);
admin.createTable(desc);
assertEquals(0, admin.listTables().length);
assertTrue(admin.tableExists(tableName));
admin.disableTable(desc.getTableName());
admin.deleteTable(desc.getTableName());
}
代码示例来源: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
@Test
public void testEnableTableReplication() throws Exception {
admin.enableTableRep(tableName);
assertTrue(utility2.getAdmin().tableExists(tableName));
}
代码示例来源:origin: apache/hbase
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getAdmin();
try {
admin.createTable(htd);
fail();
} catch(Exception ex) {
// should throw ex
}
assertFalse(admin.tableExists(htd.getTableName()));
}
}
代码示例来源:origin: apache/hbase
private void checkTableIsLegal(HTableDescriptor htd) throws IOException {
Admin admin = TEST_UTIL.getAdmin();
admin.createTable(htd);
assertTrue(admin.tableExists(htd.getTableName()));
TEST_UTIL.deleteTable(htd.getTableName());
}
代码示例来源:origin: apache/hbase
@After
public void clearQuotaTable() throws Exception {
if (TEST_UTIL.getAdmin().tableExists(QuotaUtil.QUOTA_TABLE_NAME)) {
TEST_UTIL.getAdmin().disableTable(QuotaUtil.QUOTA_TABLE_NAME);
TEST_UTIL.getAdmin().truncateTable(QuotaUtil.QUOTA_TABLE_NAME, false);
}
}
代码示例来源:origin: apache/hbase
@After
public void tearDownAfterTest() throws IOException {
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE_NAME)) {
if (admin.isTableEnabled(TABLE_NAME)) {
TEST_UTIL.getAdmin().disableTable(TABLE_NAME);
}
TEST_UTIL.getAdmin().deleteTable(TABLE_NAME);
}
LOCATOR.clearCache(TABLE_NAME);
}
内容来源于网络,如有侵权,请联系作者删除!