use of org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.SwitchRpcThrottleState in project hbase by apache.
the class SwitchRpcThrottleProcedure method executeFromState.
@Override
protected Flow executeFromState(MasterProcedureEnv env, SwitchRpcThrottleState state) throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException {
switch(state) {
case UPDATE_SWITCH_RPC_THROTTLE_STORAGE:
try {
switchThrottleState(env, rpcThrottleEnabled);
} catch (IOException e) {
if (retryCounter == null) {
retryCounter = ProcedureUtil.createRetryCounter(env.getMasterConfiguration());
}
long backoff = retryCounter.getBackoffTimeAndIncrementAttempts();
LOG.warn("Failed to store rpc throttle value {}, sleep {} secs and retry", rpcThrottleEnabled, backoff / 1000, e);
setTimeout(Math.toIntExact(backoff));
setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT);
skipPersistence();
throw new ProcedureSuspendedException();
}
setNextState(SwitchRpcThrottleState.SWITCH_RPC_THROTTLE_ON_RS);
return Flow.HAS_MORE_STATE;
case SWITCH_RPC_THROTTLE_ON_RS:
SwitchRpcThrottleRemoteProcedure[] subProcedures = env.getMasterServices().getServerManager().getOnlineServersList().stream().map(sn -> new SwitchRpcThrottleRemoteProcedure(sn, rpcThrottleEnabled)).toArray(SwitchRpcThrottleRemoteProcedure[]::new);
addChildProcedure(subProcedures);
setNextState(SwitchRpcThrottleState.POST_SWITCH_RPC_THROTTLE);
return Flow.HAS_MORE_STATE;
case POST_SWITCH_RPC_THROTTLE:
ProcedurePrepareLatch.releaseLatch(syncLatch, this);
return Flow.NO_MORE_STATE;
default:
throw new UnsupportedOperationException("unhandled state=" + state);
}
}
Aggregations