Search in sources :

Example 31 with TableNotFoundException

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;
    }
}
Also used : TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) TableExistsException(org.apache.hadoop.hbase.TableExistsException) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) TableExistsException(org.apache.hadoop.hbase.TableExistsException)

Example 32 with TableNotFoundException

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();
}
Also used : TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) Admin(org.apache.hadoop.hbase.client.Admin) TableNotEnabledException(org.apache.hadoop.hbase.TableNotEnabledException) After(org.junit.After)

Example 33 with TableNotFoundException

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);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) Test(org.junit.Test)

Example 34 with 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);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) TableName(org.apache.hadoop.hbase.TableName) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) Test(org.junit.Test)

Example 35 with 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);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) Test(org.junit.Test)

Aggregations

TableNotFoundException (org.apache.hadoop.hbase.TableNotFoundException)42 IOException (java.io.IOException)20 TableName (org.apache.hadoop.hbase.TableName)14 TableNotEnabledException (org.apache.hadoop.hbase.TableNotEnabledException)9 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)8 Test (org.junit.Test)8 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)7 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)6 ServerName (org.apache.hadoop.hbase.ServerName)6 ArrayList (java.util.ArrayList)5 Connection (org.apache.hadoop.hbase.client.Connection)5 Table (org.apache.hadoop.hbase.client.Table)5 Path (org.apache.hadoop.fs.Path)4 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)4 TableNotDisabledException (org.apache.hadoop.hbase.TableNotDisabledException)4 RegionLocator (org.apache.hadoop.hbase.client.RegionLocator)4 InterruptedIOException (java.io.InterruptedIOException)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Map (java.util.Map)3