Search in sources :

Example 1 with SplitWALManager

use of org.apache.hadoop.hbase.master.SplitWALManager in project hbase by apache.

the class ServerCrashProcedure method isSplittingDone.

private boolean isSplittingDone(MasterProcedureEnv env, boolean splitMeta) {
    SplitWALManager splitWALManager = env.getMasterServices().getSplitWALManager();
    try {
        int wals = splitWALManager.getWALsToSplit(serverName, splitMeta).size();
        LOG.debug("Check if {} WAL splitting is done? wals={}, meta={}", serverName, wals, splitMeta);
        return wals == 0;
    } catch (IOException e) {
        LOG.warn("Get WALs of {} failed, retry...", serverName, e);
        return false;
    }
}
Also used : SplitWALManager(org.apache.hadoop.hbase.master.SplitWALManager) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) IOException(java.io.IOException)

Example 2 with SplitWALManager

use of org.apache.hadoop.hbase.master.SplitWALManager in project hbase by apache.

the class ServerCrashProcedure method createSplittingWalProcedures.

private Procedure[] createSplittingWalProcedures(MasterProcedureEnv env, boolean splitMeta) throws IOException {
    LOG.info("Splitting WALs {}, isMeta: {}", this, splitMeta);
    SplitWALManager splitWALManager = env.getMasterServices().getSplitWALManager();
    List<Procedure> procedures = splitWALManager.splitWALs(serverName, splitMeta);
    return procedures.toArray(new Procedure[procedures.size()]);
}
Also used : SplitWALManager(org.apache.hadoop.hbase.master.SplitWALManager) StateMachineProcedure(org.apache.hadoop.hbase.procedure2.StateMachineProcedure) ClaimReplicationQueuesProcedure(org.apache.hadoop.hbase.master.replication.ClaimReplicationQueuesProcedure) Procedure(org.apache.hadoop.hbase.procedure2.Procedure) TransitRegionStateProcedure(org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure)

Example 3 with SplitWALManager

use of org.apache.hadoop.hbase.master.SplitWALManager in project hbase by apache.

the class SplitWALProcedure method executeFromState.

@Override
protected Flow executeFromState(MasterProcedureEnv env, MasterProcedureProtos.SplitWALState state) throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException {
    SplitWALManager splitWALManager = env.getMasterServices().getSplitWALManager();
    switch(state) {
        case ACQUIRE_SPLIT_WAL_WORKER:
            worker = splitWALManager.acquireSplitWALWorker(this);
            setNextState(MasterProcedureProtos.SplitWALState.DISPATCH_WAL_TO_WORKER);
            return Flow.HAS_MORE_STATE;
        case DISPATCH_WAL_TO_WORKER:
            assert worker != null;
            addChildProcedure(new SplitWALRemoteProcedure(worker, crashedServer, walPath));
            setNextState(MasterProcedureProtos.SplitWALState.RELEASE_SPLIT_WORKER);
            return Flow.HAS_MORE_STATE;
        case RELEASE_SPLIT_WORKER:
            boolean finished;
            try {
                finished = splitWALManager.isSplitWALFinished(walPath);
            } catch (IOException ioe) {
                if (retryCounter == null) {
                    retryCounter = ProcedureUtil.createRetryCounter(env.getMasterConfiguration());
                }
                long backoff = retryCounter.getBackoffTimeAndIncrementAttempts();
                LOG.warn("Failed to check whether splitting wal {} success, wait {} seconds to retry", walPath, backoff / 1000, ioe);
                setTimeout(Math.toIntExact(backoff));
                setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT);
                skipPersistence();
                throw new ProcedureSuspendedException();
            }
            splitWALManager.releaseSplitWALWorker(worker, env.getProcedureScheduler());
            if (!finished) {
                LOG.warn("Failed to split wal {} by server {}, retry...", walPath, worker);
                setNextState(MasterProcedureProtos.SplitWALState.ACQUIRE_SPLIT_WAL_WORKER);
                return Flow.HAS_MORE_STATE;
            }
            ServerCrashProcedure.updateProgress(env, getParentProcId());
            return Flow.NO_MORE_STATE;
        default:
            throw new UnsupportedOperationException("unhandled state=" + state);
    }
}
Also used : SplitWALManager(org.apache.hadoop.hbase.master.SplitWALManager) IOException(java.io.IOException) ProcedureSuspendedException(org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException)

Aggregations

SplitWALManager (org.apache.hadoop.hbase.master.SplitWALManager)3 IOException (java.io.IOException)2 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)1 TransitRegionStateProcedure (org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure)1 ClaimReplicationQueuesProcedure (org.apache.hadoop.hbase.master.replication.ClaimReplicationQueuesProcedure)1 Procedure (org.apache.hadoop.hbase.procedure2.Procedure)1 ProcedureSuspendedException (org.apache.hadoop.hbase.procedure2.ProcedureSuspendedException)1 StateMachineProcedure (org.apache.hadoop.hbase.procedure2.StateMachineProcedure)1