use of org.apache.hadoop.hbase.TableNotFoundException in project hbase by apache.
the class MasterProcedureScheduler method completionCleanup.
@Override
public void completionCleanup(final Procedure proc) {
if (proc instanceof TableProcedureInterface) {
TableProcedureInterface iProcTable = (TableProcedureInterface) proc;
boolean tableDeleted;
if (proc.hasException()) {
Exception procEx = proc.getException().unwrapRemoteException();
if (iProcTable.getTableOperationType() == TableOperationType.CREATE) {
// create failed because the table already exist
tableDeleted = !(procEx instanceof TableExistsException);
} else {
// the operation failed because the table does not exist
tableDeleted = (procEx instanceof TableNotFoundException);
}
} else {
// the table was deleted
tableDeleted = (iProcTable.getTableOperationType() == TableOperationType.DELETE);
}
if (tableDeleted) {
markTableAsDeleted(iProcTable.getTableName(), proc);
return;
}
} else {
// No cleanup for ServerProcedureInterface types, yet.
return;
}
}
use of org.apache.hadoop.hbase.TableNotFoundException in project hbase by apache.
the class TestCoprocessorWhitelistMasterObserver method tearDownTestCoprocessorWhitelistMasterObserver.
@After
public void tearDownTestCoprocessorWhitelistMasterObserver() throws Exception {
Admin admin = UTIL.getAdmin();
try {
try {
admin.disableTable(TEST_TABLE);
} catch (TableNotEnabledException ex) {
// Table was left disabled by test
LOG.info("Table was left disabled by test");
}
admin.deleteTable(TEST_TABLE);
} catch (TableNotFoundException ex) {
// Table was not created for some reason?
LOG.info("Table was not created for some reason");
}
UTIL.shutdownMiniCluster();
}
use of org.apache.hadoop.hbase.TableNotFoundException in project hbase by apache.
the class TestRestoreSnapshotProcedure method testRestoreSnapshotToDifferentTable.
@Test(timeout = 60000)
public void testRestoreSnapshotToDifferentTable() throws Exception {
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
final TableName restoredTableName = TableName.valueOf(name.getMethodName());
final HTableDescriptor newHTD = createHTableDescriptor(restoredTableName, CF1, CF2);
long procId = ProcedureTestingUtility.submitAndWait(procExec, new RestoreSnapshotProcedure(procExec.getEnvironment(), newHTD, snapshot));
ProcedureInfo result = procExec.getResult(procId);
assertTrue(result.isFailed());
LOG.debug("Restore snapshot failed with exception: " + result.getExceptionFullMessage());
assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof TableNotFoundException);
}
use of org.apache.hadoop.hbase.TableNotFoundException in project hbase by apache.
the class TestDeleteTableProcedure method testDeleteDeletedTable.
@Test(timeout = 60000)
public void testDeleteDeletedTable() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
HRegionInfo[] regions = MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f");
UTIL.getAdmin().disableTable(tableName);
// delete the table (that exists)
long procId1 = procExec.submitProcedure(new DeleteTableProcedure(procExec.getEnvironment(), tableName));
// delete the table (that will no longer exist)
long procId2 = procExec.submitProcedure(new DeleteTableProcedure(procExec.getEnvironment(), tableName));
// Wait the completion
ProcedureTestingUtility.waitProcedure(procExec, procId1);
ProcedureTestingUtility.waitProcedure(procExec, procId2);
// First delete should succeed
ProcedureTestingUtility.assertProcNotFailed(procExec, procId1);
MasterProcedureTestingUtility.validateTableDeletion(UTIL.getHBaseCluster().getMaster(), tableName);
// Second delete should fail with TableNotFound
ProcedureInfo result = procExec.getResult(procId2);
assertTrue(result.isFailed());
LOG.debug("Delete failed with exception: " + result.getExceptionFullMessage());
assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof TableNotFoundException);
}
use of org.apache.hadoop.hbase.TableNotFoundException in project hbase by apache.
the class TestTruncateTableProcedure method testTruncateNotExistentTable.
@Test(timeout = 60000)
public void testTruncateNotExistentTable() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
long procId = ProcedureTestingUtility.submitAndWait(procExec, new TruncateTableProcedure(procExec.getEnvironment(), tableName, true));
// Second delete should fail with TableNotFound
ProcedureInfo result = procExec.getResult(procId);
assertTrue(result.isFailed());
LOG.debug("Truncate failed with exception: " + result.getExceptionFullMessage());
assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof TableNotFoundException);
}
Aggregations