YARN-1618. Fix invalid RMApp transition from NEW to FINAL_SAVING (kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1562532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bdb642032c
commit
dee247d0e2
|
@ -453,6 +453,8 @@ Release 2.4.0 - UNRELEASED
|
||||||
|
|
||||||
YARN-1629. IndexOutOfBoundsException in MaxRunningAppsEnforcer (Sandy Ryza)
|
YARN-1629. IndexOutOfBoundsException in MaxRunningAppsEnforcer (Sandy Ryza)
|
||||||
|
|
||||||
|
YARN-1618. Fix invalid RMApp transition from NEW to FINAL_SAVING (kasha)
|
||||||
|
|
||||||
Release 2.3.0 - UNRELEASED
|
Release 2.3.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -24,8 +24,10 @@ public enum RMAppEventType {
|
||||||
RECOVER,
|
RECOVER,
|
||||||
KILL,
|
KILL,
|
||||||
|
|
||||||
// Source: Scheduler
|
// Source: Scheduler and RMAppManager
|
||||||
APP_REJECTED,
|
APP_REJECTED,
|
||||||
|
|
||||||
|
// Source: Scheduler
|
||||||
APP_ACCEPTED,
|
APP_ACCEPTED,
|
||||||
|
|
||||||
// Source: RMAppAttempt
|
// Source: RMAppAttempt
|
||||||
|
|
|
@ -144,13 +144,10 @@ public class RMAppImpl implements RMApp, Recoverable {
|
||||||
RMAppState.ACCEPTED, RMAppState.FINISHED, RMAppState.FAILED,
|
RMAppState.ACCEPTED, RMAppState.FINISHED, RMAppState.FAILED,
|
||||||
RMAppState.KILLED, RMAppState.FINAL_SAVING),
|
RMAppState.KILLED, RMAppState.FINAL_SAVING),
|
||||||
RMAppEventType.RECOVER, new RMAppRecoveredTransition())
|
RMAppEventType.RECOVER, new RMAppRecoveredTransition())
|
||||||
.addTransition(RMAppState.NEW, RMAppState.FINAL_SAVING, RMAppEventType.KILL,
|
.addTransition(RMAppState.NEW, RMAppState.KILLED, RMAppEventType.KILL,
|
||||||
new FinalSavingTransition(
|
new AppKilledTransition())
|
||||||
new AppKilledTransition(), RMAppState.KILLED))
|
.addTransition(RMAppState.NEW, RMAppState.FAILED,
|
||||||
.addTransition(RMAppState.NEW, RMAppState.FINAL_SAVING,
|
RMAppEventType.APP_REJECTED, new AppRejectedTransition())
|
||||||
RMAppEventType.APP_REJECTED,
|
|
||||||
new FinalSavingTransition(
|
|
||||||
new AppRejectedTransition(), RMAppState.FAILED))
|
|
||||||
|
|
||||||
// Transitions from NEW_SAVING state
|
// Transitions from NEW_SAVING state
|
||||||
.addTransition(RMAppState.NEW_SAVING, RMAppState.NEW_SAVING,
|
.addTransition(RMAppState.NEW_SAVING, RMAppState.NEW_SAVING,
|
||||||
|
|
|
@ -295,6 +295,10 @@ public class TestRMAppTransitions {
|
||||||
verify(store, times(1)).updateApplicationState(any(ApplicationState.class));
|
verify(store, times(1)).updateApplicationState(any(ApplicationState.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertAppFinalStateNotSaved(RMApp application){
|
||||||
|
verify(store, times(0)).updateApplicationState(any(ApplicationState.class));
|
||||||
|
}
|
||||||
|
|
||||||
private void assertKilled(RMApp application) {
|
private void assertKilled(RMApp application) {
|
||||||
assertTimesAtFinish(application);
|
assertTimesAtFinish(application);
|
||||||
assertAppState(RMAppState.KILLED, application);
|
assertAppState(RMAppState.KILLED, application);
|
||||||
|
@ -321,7 +325,6 @@ public class TestRMAppTransitions {
|
||||||
StringBuilder diag = application.getDiagnostics();
|
StringBuilder diag = application.getDiagnostics();
|
||||||
Assert.assertTrue("application diagnostics is not correct",
|
Assert.assertTrue("application diagnostics is not correct",
|
||||||
diag.toString().matches(regex));
|
diag.toString().matches(regex));
|
||||||
assertAppFinalStateSaved(application);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAppUpdateSavedEvent(RMApp application) {
|
private void sendAppUpdateSavedEvent(RMApp application) {
|
||||||
|
@ -477,6 +480,7 @@ public class TestRMAppTransitions {
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application,
|
assertFailed(application,
|
||||||
".*Unmanaged application.*Failing the application.*");
|
".*Unmanaged application.*Failing the application.*");
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -506,6 +510,7 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertKilled(application);
|
assertKilled(application);
|
||||||
|
assertAppFinalStateNotSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,6 +527,7 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application, rejectedText);
|
assertFailed(application, rejectedText);
|
||||||
|
assertAppFinalStateNotSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,6 +559,7 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application, rejectedText);
|
assertFailed(application, rejectedText);
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,6 +576,7 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application, rejectedText);
|
assertFailed(application, rejectedText);
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,6 +626,7 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application, ".*" + message + ".*Failing the application.*");
|
assertFailed(application, ".*" + message + ".*Failing the application.*");
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,12 +712,14 @@ public class TestRMAppTransitions {
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
sendAppUpdateSavedEvent(application);
|
sendAppUpdateSavedEvent(application);
|
||||||
assertFailed(application, ".*Failing the application.*");
|
assertFailed(application, ".*Failing the application.*");
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
|
|
||||||
// FAILED => FAILED event RMAppEventType.KILL
|
// FAILED => FAILED event RMAppEventType.KILL
|
||||||
event = new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
event = new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
||||||
application.handle(event);
|
application.handle(event);
|
||||||
rmDispatcher.await();
|
rmDispatcher.await();
|
||||||
assertFailed(application, ".*Failing the application.*");
|
assertFailed(application, ".*Failing the application.*");
|
||||||
|
assertAppFinalStateSaved(application);
|
||||||
verify(writer).applicationFinished(any(RMApp.class));
|
verify(writer).applicationFinished(any(RMApp.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue