HBASE-15591 ServerCrashProcedure not yielding

This commit is contained in:
Jerry He 2016-04-10 17:02:39 -07:00
parent f7d44e929f
commit 80df1cb7b6
1 changed files with 14 additions and 3 deletions

View File

@ -172,7 +172,7 @@ implements ServerProcedureInterface {
@Override @Override
protected Flow executeFromState(MasterProcedureEnv env, ServerCrashState state) protected Flow executeFromState(MasterProcedureEnv env, ServerCrashState state)
throws ProcedureYieldException { throws ProcedureYieldException {
if (LOG.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOG.trace(state); LOG.trace(state);
} }
@ -208,10 +208,17 @@ implements ServerProcedureInterface {
case SERVER_CRASH_GET_REGIONS: case SERVER_CRASH_GET_REGIONS:
// If hbase:meta is not assigned, yield. // If hbase:meta is not assigned, yield.
if (!isMetaAssignedQuickTest(env)) { if (!isMetaAssignedQuickTest(env)) {
// isMetaAssignedQuickTest does not really wait. Let's delay a little before
// another round of execution.
long wait =
env.getMasterConfiguration().getLong(KEY_SHORT_WAIT_ON_META,
DEFAULT_SHORT_WAIT_ON_META);
wait = wait / 10;
Thread.sleep(wait);
throwProcedureYieldException("Waiting on hbase:meta assignment"); throwProcedureYieldException("Waiting on hbase:meta assignment");
} }
this.regionsOnCrashedServer = this.regionsOnCrashedServer =
services.getAssignmentManager().getRegionStates().getServerRegions(this.serverName); services.getAssignmentManager().getRegionStates().getServerRegions(this.serverName);
// Where to go next? Depends on whether we should split logs at all or if we should do // Where to go next? Depends on whether we should split logs at all or if we should do
// distributed log splitting (DLS) vs distributed log replay (DLR). // distributed log splitting (DLS) vs distributed log replay (DLR).
if (!this.shouldSplitWal) { if (!this.shouldSplitWal) {
@ -291,8 +298,12 @@ implements ServerProcedureInterface {
return Flow.NO_MORE_STATE; return Flow.NO_MORE_STATE;
default: default:
throw new UnsupportedOperationException("unhandled state=" + state); throw new UnsupportedOperationException("unhandled state=" + state);
} }
} catch (ProcedureYieldException e) {
LOG.warn("Failed serverName=" + this.serverName + ", state=" + state + "; retry "
+ e.getMessage());
throw e;
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failed serverName=" + this.serverName + ", state=" + state + "; retry", e); LOG.warn("Failed serverName=" + this.serverName + ", state=" + state + "; retry", e);
} catch (InterruptedException e) { } catch (InterruptedException e) {