use of org.apache.hadoop.hbase.TableExistsException in project hbase by apache.
the class TestSCVFWithMiniCluster method create.
private static void create(Admin admin, TableName tableName, byte[]... families) throws IOException {
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableName);
for (byte[] family : families) {
ColumnFamilyDescriptor familyDescriptor = ColumnFamilyDescriptorBuilder.newBuilder(family).setMaxVersions(1).setCompressionType(Algorithm.GZ).build();
builder.setColumnFamily(familyDescriptor);
}
try {
admin.createTable(builder.build());
} catch (TableExistsException tee) {
/* Ignore */
}
}
use of org.apache.hadoop.hbase.TableExistsException in project hbase by apache.
the class TestRSGroupsAdmin1 method testNotMoveTableToNullRSGroupWhenCreatingExistingTable.
@Test
public void testNotMoveTableToNullRSGroupWhenCreatingExistingTable() throws Exception {
// Trigger
TableName tn1 = TableName.valueOf("t1");
TEST_UTIL.createTable(tn1, "cf1");
try {
// Create an existing table to trigger HBASE-21866
TEST_UTIL.createTable(tn1, "cf1");
} catch (TableExistsException teex) {
// Ignore
}
// Wait then verify
// Could not verify until the rollback of CreateTableProcedure is done
// (that is, the coprocessor finishes its work),
// or the table is still in the "default" rsgroup even though HBASE-21866
// is not fixed.
TEST_UTIL.waitFor(5000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
return MASTER.getMasterProcedureExecutor().getActiveExecutorCount() == 0;
}
});
Set<TableName> tables = Sets.newHashSet(ADMIN.listTablesInRSGroup(RSGroupInfo.DEFAULT_GROUP));
assertTrue("Table 't1' must be in 'default' rsgroup", tables.contains(tn1));
// Cleanup
TEST_UTIL.deleteTable(tn1);
}
Aggregations