use of org.apache.hadoop.hbase.TableNotDisabledException in project hbase by apache.
the class TestRestoreSnapshotProcedure method testRestoreSnapshotToEnabledTable.
@Test(timeout = 60000)
public void testRestoreSnapshotToEnabledTable() throws Exception {
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
try {
UTIL.getAdmin().enableTable(snapshotTableName);
long procId = ProcedureTestingUtility.submitAndWait(procExec, new RestoreSnapshotProcedure(procExec.getEnvironment(), snapshotHTD, snapshot));
ProcedureInfo result = procExec.getResult(procId);
assertTrue(result.isFailed());
LOG.debug("Restore snapshot failed with exception: " + result.getExceptionFullMessage());
assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof TableNotDisabledException);
} finally {
UTIL.getAdmin().disableTable(snapshotTableName);
}
}
use of org.apache.hadoop.hbase.TableNotDisabledException in project hbase by apache.
the class TestTruncateTableProcedure method testTruncateNotDisabledTable.
@Test(timeout = 60000)
public void testTruncateNotDisabledTable() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f");
long procId = ProcedureTestingUtility.submitAndWait(procExec, new TruncateTableProcedure(procExec.getEnvironment(), tableName, false));
// Second delete should fail with TableNotDisabled
ProcedureInfo result = procExec.getResult(procId);
assertTrue(result.isFailed());
LOG.debug("Truncate failed with exception: " + result.getExceptionFullMessage());
assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof TableNotDisabledException);
}
use of org.apache.hadoop.hbase.TableNotDisabledException in project hbase by apache.
the class TestAdmin1 method testEnableDisableAddColumnDeleteColumn.
@Test(timeout = 300000)
public void testEnableDisableAddColumnDeleteColumn() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY).close();
while (!this.admin.isTableEnabled(TableName.valueOf(name.getMethodName()))) {
Thread.sleep(10);
}
this.admin.disableTable(tableName);
try {
TEST_UTIL.getConnection().getTable(tableName);
} catch (org.apache.hadoop.hbase.DoNotRetryIOException e) {
//expected
}
this.admin.addColumnFamily(tableName, new HColumnDescriptor("col2"));
this.admin.enableTable(tableName);
try {
this.admin.deleteColumnFamily(tableName, Bytes.toBytes("col2"));
} catch (TableNotDisabledException e) {
LOG.info(e);
}
this.admin.disableTable(tableName);
this.admin.deleteTable(tableName);
}
use of org.apache.hadoop.hbase.TableNotDisabledException in project titan by thinkaurelius.
the class HBaseAdmin1_0 method clearTable.
@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);
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);
}
}
use of org.apache.hadoop.hbase.TableNotDisabledException in project cdap by caskdata.
the class HBaseTableFactory method enableTable.
private void enableTable(HBaseDDLExecutor ddlExecutor, TableId tableId) throws IOException {
try {
TableName tableName = HTableNameConverter.toTableName(cConf.get(Constants.Dataset.TABLE_PREFIX), tableId);
ddlExecutor.enableTableIfDisabled(tableName.getNamespaceAsString(), tableName.getQualifierAsString());
LOG.debug("TMS Table {} has been enabled.", tableName);
} catch (TableNotFoundException ex) {
LOG.debug("TMS Table {} was not found. Skipping enable.", tableId, ex);
} catch (TableNotDisabledException ex) {
LOG.debug("TMS Table {} was already in enabled state.", tableId, ex);
}
}
Aggregations