Search in sources :

Example 6 with ProcedureExecutor

use of org.apache.hadoop.hbase.procedure2.ProcedureExecutor in project hbase by apache.

the class ProcedureTestingUtility method restart.

public static <TEnv> void restart(final ProcedureExecutor<TEnv> procExecutor, final boolean avoidTestKillDuringRestart, final boolean failOnCorrupted, final Callable<Void> stopAction, final Callable<Void> startAction) throws Exception {
    final ProcedureStore procStore = procExecutor.getStore();
    final int storeThreads = procExecutor.getCorePoolSize();
    final int execThreads = procExecutor.getCorePoolSize();
    final ProcedureExecutor.Testing testing = procExecutor.testing;
    if (avoidTestKillDuringRestart) {
        procExecutor.testing = null;
    }
    // stop
    LOG.info("RESTART - Stop");
    procExecutor.stop();
    procStore.stop(false);
    if (stopAction != null) {
        stopAction.call();
    }
    procExecutor.join();
    procExecutor.getScheduler().clear();
    // nothing running...
    // re-start
    LOG.info("RESTART - Start");
    procStore.start(storeThreads);
    procExecutor.start(execThreads, failOnCorrupted);
    if (startAction != null) {
        startAction.call();
    }
    if (avoidTestKillDuringRestart) {
        procExecutor.testing = testing;
    }
}
Also used : ProcedureStore(org.apache.hadoop.hbase.procedure2.store.ProcedureStore) WALProcedureStore(org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore) NoopProcedureStore(org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore)

Example 7 with ProcedureExecutor

use of org.apache.hadoop.hbase.procedure2.ProcedureExecutor in project hbase by apache.

the class ProcedureTestingUtility method submitAndWait.

public static <TEnv> long submitAndWait(Configuration conf, TEnv env, Procedure<TEnv> proc) throws IOException {
    NoopProcedureStore procStore = new NoopProcedureStore();
    ProcedureExecutor<TEnv> procExecutor = new ProcedureExecutor<>(conf, env, procStore);
    procStore.start(1);
    procExecutor.start(1, false);
    try {
        return submitAndWait(procExecutor, proc, HConstants.NO_NONCE, HConstants.NO_NONCE);
    } finally {
        procStore.stop(false);
        procExecutor.stop();
    }
}
Also used : NoopProcedureStore(org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore)

Aggregations

NoopProcedureStore (org.apache.hadoop.hbase.procedure2.store.NoopProcedureStore)4 MasterProcedureEnv (org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv)3 HBaseCommonTestingUtility (org.apache.hadoop.hbase.HBaseCommonTestingUtility)2 TableName (org.apache.hadoop.hbase.TableName)2 LockProcedure (org.apache.hadoop.hbase.master.locking.LockProcedure)2 Procedure (org.apache.hadoop.hbase.procedure2.Procedure)2 WALProcedureStore (org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore)2 Before (org.junit.Before)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 Path (org.apache.hadoop.fs.Path)1 ProcedureInfo (org.apache.hadoop.hbase.ProcedureInfo)1 ProcedureExecutor (org.apache.hadoop.hbase.procedure2.ProcedureExecutor)1 ProcedureStore (org.apache.hadoop.hbase.procedure2.store.ProcedureStore)1