This is an automated email from the ASF dual-hosted git repository. rohithsharmaks pushed a commit to branch branch-3.2.1 in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 46a1a6fc7d5e18f0caec48ce33ecb21901adfac8 Author: Jonathan Hung <jh...@linkedin.com> AuthorDate: Mon Sep 9 00:23:04 2019 -0700 YARN-9820. RM logs InvalidStateTransitionException when app is submitted. Contributed by Prabhu Joseph --- .../hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java | 7 +++++++ .../server/resourcemanager/recovery/RMStateUpdateAppEvent.java | 7 ++++++- .../apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java | 2 +- .../yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java | 7 ++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java index ccd6fc9..01606bc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateStore.java @@ -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( diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateUpdateAppEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateUpdateAppEvent.java index 0a6220b..a43d43e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateUpdateAppEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/RMStateUpdateAppEvent.java @@ -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; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java index a1e4558..84c1d86 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java @@ -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(); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java index f5dcefb..b32ad1e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestRMAppTransitions.java @@ -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) { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org