You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xg...@apache.org on 2015/05/31 09:25:03 UTC
hadoop git commit: Revert "YARN-2900. Application (Attempt and
Container) Not Found in AHS results"
Repository: hadoop
Updated Branches:
refs/heads/branch-2 4fee8b320 -> 1ebaff0b8
Revert "YARN-2900. Application (Attempt and Container) Not Found in AHS results"
This reverts commit 4fee8b320276bac86278e1ae0a3397592a78aa18.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1ebaff0b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1ebaff0b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1ebaff0b
Branch: refs/heads/branch-2
Commit: 1ebaff0b8669f26b1ff573c48afc38b6a3405f90
Parents: 4fee8b3
Author: Xuan <xg...@apache.org>
Authored: Sun May 31 00:24:08 2015 -0700
Committer: Xuan <xg...@apache.org>
Committed: Sun May 31 00:24:08 2015 -0700
----------------------------------------------------------------------
hadoop-yarn-project/CHANGES.txt | 3 -
.../timeline/webapp/TimelineWebServices.java | 2 +
.../TestApplicationHistoryClientService.java | 70 +-------------------
.../hadoop/yarn/server/webapp/WebServices.java | 27 +++-----
4 files changed, 13 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ebaff0b/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 7653b2f..28ca374 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -562,9 +562,6 @@ Release 2.7.1 - UNRELEASED
YARN-3686. CapacityScheduler should trim default_node_label_expression.
(Sunil G via wangda)
- YARN-2900. Application (Attempt and Container) Not Found in AHS results
- in InternalServer Error (500). (Zhijie Shen and Mit Desai via xgong)
-
Release 2.7.0 - 2015-04-20
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ebaff0b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java
index 40e9fed..90f4d39 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java
@@ -47,6 +47,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.StringUtils;
+import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain;
import org.apache.hadoop.yarn.api.records.timeline.TimelineDomains;
import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities;
@@ -60,6 +61,7 @@ import org.apache.hadoop.yarn.server.timeline.NameValuePair;
import org.apache.hadoop.yarn.server.timeline.TimelineDataManager;
import org.apache.hadoop.yarn.server.timeline.TimelineReader.Field;
import org.apache.hadoop.yarn.api.records.timeline.TimelineAbout;
+import org.apache.hadoop.yarn.util.YarnVersionInfo;
import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
import org.apache.hadoop.yarn.webapp.BadRequestException;
import org.apache.hadoop.yarn.webapp.ForbiddenException;
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ebaff0b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
index d04903c..764ecb9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java
@@ -41,9 +41,6 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.security.ApplicationACLsManager;
import org.apache.hadoop.yarn.server.timeline.TimelineDataManager;
@@ -57,13 +54,12 @@ public class TestApplicationHistoryClientService {
private static ApplicationHistoryClientService clientService;
private static TimelineDataManager dataManager;
- private final static int MAX_APPS = 2;
@BeforeClass
public static void setup() throws Exception {
Configuration conf = new YarnConfiguration();
TimelineStore store =
- TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS);
+ TestApplicationHistoryManagerOnTimelineStore.createStore(2);
TimelineACLsManager aclsManager = new TimelineACLsManager(conf);
dataManager =
new TimelineDataManager(store, aclsManager);
@@ -76,70 +72,6 @@ public class TestApplicationHistoryClientService {
}
@Test
- public void testApplicationNotFound() throws IOException, YarnException {
- ApplicationId appId = null;
- appId = ApplicationId.newInstance(0, MAX_APPS + 1);
- GetApplicationReportRequest request =
- GetApplicationReportRequest.newInstance(appId);
- try {
- @SuppressWarnings("unused")
- GetApplicationReportResponse response =
- clientService.getApplicationReport(request);
- Assert.fail("Exception should have been thrown before we reach here.");
- } catch (ApplicationNotFoundException e) {
- //This exception is expected.
- Assert.assertTrue(e.getMessage().contains(
- "doesn't exist in the timeline store"));
- } catch (Exception e) {
- Assert.fail("Undesired exception caught");
- }
- }
-
- @Test
- public void testApplicationAttemptNotFound() throws IOException, YarnException {
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, MAX_APPS + 1);
- GetApplicationAttemptReportRequest request =
- GetApplicationAttemptReportRequest.newInstance(appAttemptId);
- try {
- @SuppressWarnings("unused")
- GetApplicationAttemptReportResponse response =
- clientService.getApplicationAttemptReport(request);
- Assert.fail("Exception should have been thrown before we reach here.");
- } catch (ApplicationAttemptNotFoundException e) {
- //This Exception is expected
- System.out.println(e.getMessage());
- Assert.assertTrue(e.getMessage().contains(
- "doesn't exist in the timeline store"));
- } catch (Exception e) {
- Assert.fail("Undesired exception caught");
- }
- }
-
- @Test
- public void testContainerNotFound() throws IOException, YarnException {
- ApplicationId appId = ApplicationId.newInstance(0, 1);
- ApplicationAttemptId appAttemptId =
- ApplicationAttemptId.newInstance(appId, 1);
- ContainerId containerId = ContainerId.newContainerId(appAttemptId,
- MAX_APPS + 1);
- GetContainerReportRequest request =
- GetContainerReportRequest.newInstance(containerId);
- try {
- @SuppressWarnings("unused")
- GetContainerReportResponse response =
- clientService.getContainerReport(request);
- } catch (ContainerNotFoundException e) {
- //This exception is expected
- Assert.assertTrue(e.getMessage().contains(
- "doesn't exist in the timeline store"));
- } catch (Exception e) {
- Assert.fail("Undesired exception caught");
- }
- }
-
- @Test
public void testApplicationReport() throws IOException, YarnException {
ApplicationId appId = null;
appId = ApplicationId.newInstance(0, 1);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/1ebaff0b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
index ae27d45..8404719 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java
@@ -47,9 +47,6 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest;
-import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException;
import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo;
import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo;
import org.apache.hadoop.yarn.server.webapp.dao.AppInfo;
@@ -480,21 +477,17 @@ public class WebServices {
private static void rewrapAndThrowException(Exception e) {
if (e instanceof UndeclaredThrowableException) {
- rewrapAndThrowThrowable(e.getCause());
- } else {
- rewrapAndThrowThrowable(e);
- }
- }
-
- private static void rewrapAndThrowThrowable(Throwable t) {
- if (t instanceof AuthorizationException) {
- throw new ForbiddenException(t);
- } if (t instanceof ApplicationNotFoundException ||
- t instanceof ApplicationAttemptNotFoundException ||
- t instanceof ContainerNotFoundException) {
- throw new NotFoundException(t);
+ if (e.getCause() instanceof AuthorizationException) {
+ throw new ForbiddenException(e.getCause());
+ } else {
+ throw new WebApplicationException(e.getCause());
+ }
} else {
- throw new WebApplicationException(t);
+ if (e instanceof AuthorizationException) {
+ throw new ForbiddenException(e);
+ } else {
+ throw new WebApplicationException(e);
+ }
}
}