Repository: hadoop Updated Branches: refs/heads/branch-2.7 70e53cf74 -> 7d046dd37 refs/heads/branch-2.8 26673b312 -> 435b6ae82
Revert "YARN-4452. NPE when submit Unmanaged application. Contributed by Naganarasimha G R." This reverts commit 92de57bdca84350539954e8c839789606941b934. Conflicts: hadoop-yarn-project/CHANGES.txt Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a025b7b7 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a025b7b7 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a025b7b7 Branch: refs/heads/branch-2.8 Commit: a025b7b7ea804bcab34d3363d8bacae1545e562c Parents: 26673b3 Author: Jason Lowe <jl...@apache.org> Authored: Mon Jan 25 16:03:27 2016 +0000 Committer: Jason Lowe <jl...@apache.org> Committed: Mon Jan 25 16:03:27 2016 +0000 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 9 ------ .../metrics/SystemMetricsPublisher.java | 11 +++---- .../metrics/TestSystemMetricsPublisher.java | 34 ++++---------------- 3 files changed, 10 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/a025b7b7/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 9c96c29..bde7e67 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -1100,9 +1100,6 @@ Release 2.8.0 - UNRELEASED YARN-4402. TestNodeManagerShutdown And TestNodeManagerResync fails with bind exception. (Brahma Reddy Battula via jianhe) - YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R - via junping_du) - YARN-4392. ApplicationCreatedEvent event time resets after RM restart/failover. (Naganarasimha G R and Xuan Gong via xgong) @@ -1214,9 +1211,6 @@ Release 2.7.3 - UNRELEASED YARN-4439. Clarify NMContainerStatus#toString method. (Jian He via xgong) - YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R - via junping_du) - YARN-4398. Remove unnecessary synchronization in RMStateStore. (Ning Ding via jianhe) YARN-4422. Generic AHS sometimes doesn't show started, node, or logs on App page @@ -2098,9 +2092,6 @@ Release 2.6.4 - UNRELEASED BUG FIXES - YARN-4452. NPE when submit Unmanaged application. (Naganarasimha G R - via junping_du) - YARN-4546. ResourceManager crash due to scheduling opportunity overflow. (Jason Lowe via junping_du) http://git-wip-us.apache.org/repos/asf/hadoop/blob/a025b7b7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java index dcb3ccf..2c6349c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java @@ -161,8 +161,6 @@ public class SystemMetricsPublisher extends CompositeService { public void appAttemptRegistered(RMAppAttempt appAttempt, long registeredTime) { if (publishSystemMetrics) { - ContainerId container = (appAttempt.getMasterContainer() == null) ? null - : appAttempt.getMasterContainer().getId(); dispatcher.getEventHandler().handle( new AppAttemptRegisteredEvent( appAttempt.getAppAttemptId(), @@ -170,7 +168,7 @@ public class SystemMetricsPublisher extends CompositeService { appAttempt.getRpcPort(), appAttempt.getTrackingUrl(), appAttempt.getOriginalTrackingUrl(), - container, + appAttempt.getMasterContainer().getId(), registeredTime)); } } @@ -393,10 +391,9 @@ public class SystemMetricsPublisher extends CompositeService { event.getHost()); eventInfo.put(AppAttemptMetricsConstants.RPC_PORT_EVENT_INFO, event.getRpcPort()); - if (event.getMasterContainerId() != null) { - eventInfo.put(AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, - event.getMasterContainerId().toString()); - } + eventInfo.put( + AppAttemptMetricsConstants.MASTER_CONTAINER_EVENT_INFO, + event.getMasterContainerId().toString()); tEvent.setEventInfo(eventInfo); entity.addEvent(tEvent); putEntity(entity); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a025b7b7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java index f2b02bc..4835ade 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java @@ -257,30 +257,10 @@ public class TestSystemMetricsPublisher { } @Test(timeout = 10000) - public void testPublishAppAttemptMetricsForUnmanagedAM() throws Exception { - ApplicationAttemptId appAttemptId = - ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1); - RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId,true); - metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L); - RMApp app = mock(RMApp.class); - when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED); - metricsPublisher.appAttemptFinished(appAttempt, RMAppAttemptState.FINISHED, app, - Integer.MAX_VALUE + 2L); - TimelineEntity entity = null; - do { - entity = - store.getEntity(appAttemptId.toString(), - AppAttemptMetricsConstants.ENTITY_TYPE, - EnumSet.allOf(Field.class)); - // ensure two events are both published before leaving the loop - } while (entity == null || entity.getEvents().size() < 2); - } - - @Test(timeout = 10000) public void testPublishAppAttemptMetrics() throws Exception { ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1); - RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId, false); + RMAppAttempt appAttempt = createRMAppAttempt(appAttemptId); metricsPublisher.appAttemptRegistered(appAttempt, Integer.MAX_VALUE + 1L); RMApp app = mock(RMApp.class); when(app.getFinalApplicationStatus()).thenReturn(FinalApplicationStatus.UNDEFINED); @@ -455,17 +435,15 @@ public class TestSystemMetricsPublisher { } private static RMAppAttempt createRMAppAttempt( - ApplicationAttemptId appAttemptId, boolean unmanagedAMAttempt) { + ApplicationAttemptId appAttemptId) { RMAppAttempt appAttempt = mock(RMAppAttempt.class); when(appAttempt.getAppAttemptId()).thenReturn(appAttemptId); when(appAttempt.getHost()).thenReturn("test host"); when(appAttempt.getRpcPort()).thenReturn(-100); - if (!unmanagedAMAttempt) { - Container container = mock(Container.class); - when(container.getId()) - .thenReturn(ContainerId.newContainerId(appAttemptId, 1)); - when(appAttempt.getMasterContainer()).thenReturn(container); - } + Container container = mock(Container.class); + when(container.getId()) + .thenReturn(ContainerId.newContainerId(appAttemptId, 1)); + when(appAttempt.getMasterContainer()).thenReturn(container); when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info"); when(appAttempt.getTrackingUrl()).thenReturn("test tracking url"); when(appAttempt.getOriginalTrackingUrl()).thenReturn(