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 45220d1157
commit 1f0449ddfb
4 changed files with 20 additions and 3 deletions

View File

@ -868,6 +868,13 @@ public abstract class RMStateStore extends AbstractService {
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 class RMAppImpl implements RMApp, Recoverable {
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();
}
}

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.server.resourcemanager.rmapp;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.eq;
@ -472,8 +473,12 @@ public class TestRMAppTransitions {
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) {