Search in sources :

Example 41 with ProcedureInfo

use of org.apache.hadoop.hbase.ProcedureInfo 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);
    }
}
Also used : TableNotDisabledException(org.apache.hadoop.hbase.TableNotDisabledException) ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) Test(org.junit.Test)

Example 42 with ProcedureInfo

use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.

the class TestLockProcedure method tearDown.

@After
public void tearDown() throws Exception {
    ProcedureTestingUtility.setKillAndToggleBeforeStoreUpdate(procExec, false);
    // Kill all running procedures.
    for (ProcedureInfo procInfo : procExec.listProcedures()) {
        Procedure proc = procExec.getProcedure(procInfo.getProcId());
        if (proc == null)
            continue;
        procExec.abort(procInfo.getProcId());
        ProcedureTestingUtility.waitProcedure(procExec, proc);
    }
    assertEquals(0, procExec.getEnvironment().getProcedureScheduler().size());
}
Also used : ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) Procedure(org.apache.hadoop.hbase.procedure2.Procedure) After(org.junit.After)

Example 43 with ProcedureInfo

use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.

the class TestDeleteColumnFamilyProcedure method testDeleteNonExistingColumnFamily.

@Test(timeout = 60000)
public void testDeleteNonExistingColumnFamily() throws Exception {
    final TableName tableName = TableName.valueOf(name.getMethodName());
    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
    final String cf3 = "cf3";
    MasterProcedureTestingUtility.createTable(procExec, tableName, null, "f1", "f2");
    // delete the column family that does not exist
    long procId1 = procExec.submitProcedure(new DeleteColumnFamilyProcedure(procExec.getEnvironment(), tableName, cf3.getBytes()));
    // Wait the completion
    ProcedureTestingUtility.waitProcedure(procExec, procId1);
    ProcedureInfo result = procExec.getResult(procId1);
    assertTrue(result.isFailed());
    LOG.debug("Delete failed with exception: " + result.getExceptionFullMessage());
    assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof InvalidFamilyOperationException);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) InvalidFamilyOperationException(org.apache.hadoop.hbase.InvalidFamilyOperationException) Test(org.junit.Test)

Example 44 with ProcedureInfo

use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.

the class TestDeleteNamespaceProcedure method testDeleteNonExistNamespace.

@Test(timeout = 60000)
public void testDeleteNonExistNamespace() throws Exception {
    final String namespaceName = "testDeleteNonExistNamespace";
    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
    validateNamespaceNotExist(namespaceName);
    long procId = procExec.submitProcedure(new DeleteNamespaceProcedure(procExec.getEnvironment(), namespaceName));
    // Wait the completion
    ProcedureTestingUtility.waitProcedure(procExec, procId);
    // Expect fail with NamespaceNotFoundException
    ProcedureInfo result = procExec.getResult(procId);
    assertTrue(result.isFailed());
    LOG.debug("Delete namespace failed with exception: " + result.getExceptionFullMessage());
    assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof NamespaceNotFoundException);
}
Also used : ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) NamespaceNotFoundException(org.apache.hadoop.hbase.NamespaceNotFoundException) Test(org.junit.Test)

Example 45 with ProcedureInfo

use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.

the class TestCreateNamespaceProcedure method testCreateSystemNamespace.

@Test(timeout = 60000)
public void testCreateSystemNamespace() throws Exception {
    final NamespaceDescriptor nsd = UTIL.getAdmin().getNamespaceDescriptor(NamespaceDescriptor.SYSTEM_NAMESPACE.getName());
    final ProcedureExecutor<MasterProcedureEnv> procExec = getMasterProcedureExecutor();
    long procId = procExec.submitProcedure(new CreateNamespaceProcedure(procExec.getEnvironment(), nsd));
    // Wait the completion
    ProcedureTestingUtility.waitProcedure(procExec, procId);
    ProcedureInfo result = procExec.getResult(procId);
    assertTrue(result.isFailed());
    LOG.debug("Create namespace failed with exception: " + result.getExceptionFullMessage());
    assertTrue(ProcedureTestingUtility.getExceptionCause(result) instanceof NamespaceExistException);
}
Also used : ProcedureInfo(org.apache.hadoop.hbase.ProcedureInfo) NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor) NamespaceExistException(org.apache.hadoop.hbase.NamespaceExistException) Test(org.junit.Test)

Aggregations

ProcedureInfo (org.apache.hadoop.hbase.ProcedureInfo)57 Test (org.junit.Test)42 TableName (org.apache.hadoop.hbase.TableName)16 ArrayList (java.util.ArrayList)7 NamespaceDescriptor (org.apache.hadoop.hbase.NamespaceDescriptor)7 ConstraintException (org.apache.hadoop.hbase.constraint.ConstraintException)6 NonceKey (org.apache.hadoop.hbase.util.NonceKey)5 IOException (java.io.IOException)4 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)4 InvalidFamilyOperationException (org.apache.hadoop.hbase.InvalidFamilyOperationException)4 Procedure (org.apache.hadoop.hbase.procedure2.Procedure)4 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)3 TableNotDisabledException (org.apache.hadoop.hbase.TableNotDisabledException)3 TableNotFoundException (org.apache.hadoop.hbase.TableNotFoundException)3 LockProcedure (org.apache.hadoop.hbase.master.locking.LockProcedure)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)2 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)2 NamespaceExistException (org.apache.hadoop.hbase.NamespaceExistException)2 NamespaceNotFoundException (org.apache.hadoop.hbase.NamespaceNotFoundException)2