use of org.apache.hadoop.hbase.ProcedureInfo 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.ProcedureInfo in project hbase by apache.
the class TestProcedureRecovery method testStateMachineRollbackRecovery.
@Test(timeout = 30000)
public void testStateMachineRollbackRecovery() throws Exception {
ProcedureTestingUtility.setToggleKillBeforeStoreUpdate(procExecutor, true);
ProcedureTestingUtility.setKillBeforeStoreUpdate(procExecutor, true);
// Step 1 - kill
Procedure proc = new TestStateMachineProcedure();
long procId = ProcedureTestingUtility.submitAndWait(procExecutor, proc);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Step 1 exec && Step 2 - kill
restart();
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Step 2 exec && step 3 - kill
restart();
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Step 3 exec - rollback step 3 - kill
procSleepInterval = 2500;
restart();
assertTrue(procExecutor.abort(procId));
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Rollback step 3 - rollback step 2 - kill
restart();
waitProcedure(procId);
assertFalse(procExecutor.isRunning());
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
// Rollback step 2 - step 1 - kill
restart();
waitProcedure(procId);
assertFalse(procExecutor.isRunning());
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
// Rollback step 1 - complete
restart();
waitProcedure(procId);
assertTrue(procExecutor.isRunning());
// The procedure is completed
ProcedureInfo result = procExecutor.getResult(procId);
ProcedureTestingUtility.assertIsAbortException(result);
}
use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.
the class TestProcedureRecovery method testStateMachineRecovery.
@Test(timeout = 30000)
public void testStateMachineRecovery() throws Exception {
ProcedureTestingUtility.setToggleKillBeforeStoreUpdate(procExecutor, true);
ProcedureTestingUtility.setKillBeforeStoreUpdate(procExecutor, true);
// Step 1 - kill
Procedure proc = new TestStateMachineProcedure();
long procId = ProcedureTestingUtility.submitAndWait(procExecutor, proc);
assertFalse(procExecutor.isRunning());
// Step 1 exec && Step 2 - kill
restart();
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Step 2 exec && step 3 - kill
restart();
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
// Step 3 exec
restart();
waitProcedure(procId);
ProcedureTestingUtility.assertProcNotYetCompleted(procExecutor, procId);
assertFalse(procExecutor.isRunning());
restart();
waitProcedure(procId);
assertTrue(procExecutor.isRunning());
// The procedure is completed
ProcedureInfo result = procExecutor.getResult(procId);
ProcedureTestingUtility.assertProcNotFailed(result);
assertEquals(26, Bytes.toInt(result.getResult()));
}
use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.
the class ProcedureTestingUtility method assertProcFailed.
public static <TEnv> Throwable assertProcFailed(final ProcedureExecutor<TEnv> procExecutor, final long procId) {
ProcedureInfo result = procExecutor.getResult(procId);
assertTrue("expected procedure result", result != null);
return assertProcFailed(result);
}
use of org.apache.hadoop.hbase.ProcedureInfo in project hbase by apache.
the class TestChildProcedures method assertProcFailed.
private void assertProcFailed(long procId) {
assertTrue("expected completed proc", procExecutor.isFinished(procId));
ProcedureInfo result = procExecutor.getResult(procId);
assertEquals(true, result.isFailed());
LOG.info(result.getException().getMessage());
}
Aggregations