YARN-9820. RM logs InvalidStateTransitionException when app is submitted. Contributed by Prabhu Joseph

This commit is contained in:
Jonathan Hung 2019-09-09 00:23:04 -07:00
parent 3b9584d12b
commit 387c332b64
4 changed files with 20 additions and 3 deletions

View File

@ -947,6 +947,13 @@ public void updateApplicationState(ApplicationStateData appState) {
getRMStateStoreEventHandler().handle(new RMStateUpdateAppEvent(appState));
}
@SuppressWarnings("unchecked")
public void updateApplicationState(ApplicationStateData appState,
boolean notifyApp) {
getRMStateStoreEventHandler().handle(new RMStateUpdateAppEvent(appState,
notifyApp));
}
public void updateApplicationStateSynchronously(ApplicationStateData appState,
boolean notifyApp, SettableFuture<Object> resultFuture) {
handleStoreEvent(

View File

@ -30,9 +30,14 @@ public class RMStateUpdateAppEvent extends RMStateStoreEvent {
private SettableFuture<Object> future;
public RMStateUpdateAppEvent(ApplicationStateData appState) {
this (appState, true);
}
public RMStateUpdateAppEvent(ApplicationStateData appState,
boolean notifyApplication) {
super(RMStateStoreEventType.UPDATE_APP);
this.appState = appState;
this.notifyApplication = true;
this.notifyApplication = notifyApplication;
this.future = null;
}

View File

@ -1037,7 +1037,7 @@ public void transition(RMAppImpl app, RMAppEvent event) {
app.callerContext);
appState.setApplicationTimeouts(app.getApplicationTimeouts());
appState.setLaunchTime(event.getTimestamp());
app.rmContext.getStateStore().updateApplicationState(appState);
app.rmContext.getStateStore().updateApplicationState(appState, false);
app.launchTime = event.getTimestamp();
app.rmContext.getSystemMetricsPublisher().appLaunched(
app, app.launchTime);

View File

@ -109,6 +109,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
@ -486,8 +487,12 @@ private void assertAppFinalStateNotSaved(RMApp application){
private void assertAppStateLaunchTimeSaved(long expectedLaunchTime) {
ArgumentCaptor<ApplicationStateData> state =
ArgumentCaptor.forClass(ApplicationStateData.class);
verify(store, times(1)).updateApplicationState(state.capture());
ArgumentCaptor<Boolean> notifyApp =
ArgumentCaptor.forClass(Boolean.class);
verify(store, times(1)).updateApplicationState(state.capture(),
notifyApp.capture());
assertEquals(expectedLaunchTime, state.getValue().getLaunchTime());
assertFalse(notifyApp.getValue());
}
private void assertKilled(RMApp application) {