Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3FD55176F5 for ; Thu, 6 Nov 2014 19:49:27 +0000 (UTC) Received: (qmail 21590 invoked by uid 500); 6 Nov 2014 19:49:27 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 21521 invoked by uid 500); 6 Nov 2014 19:49:27 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 21512 invoked by uid 99); 6 Nov 2014 19:49:26 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2014 19:49:26 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B26828BC9F4; Thu, 6 Nov 2014 19:49:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vinodkv@apache.org To: common-commits@hadoop.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hadoop git commit: YARN-2818. Removed the now unnecessary user entity injection from Timeline service given we now have domains. Contributed by Zhijie Shen. Date: Thu, 6 Nov 2014 19:49:26 +0000 (UTC) Repository: hadoop Updated Branches: refs/heads/trunk 10f9f5101 -> f5b19bed7 YARN-2818. Removed the now unnecessary user entity injection from Timeline service given we now have domains. Contributed by Zhijie Shen. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/f5b19bed Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/f5b19bed Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/f5b19bed Branch: refs/heads/trunk Commit: f5b19bed7d71979dc8685b03152188902b6e45e9 Parents: 10f9f51 Author: Vinod Kumar Vavilapalli Authored: Thu Nov 6 11:48:40 2014 -0800 Committer: Vinod Kumar Vavilapalli Committed: Thu Nov 6 11:48:40 2014 -0800 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 + .../server/timeline/TimelineDataManager.java | 71 +------------------- .../webapp/TestTimelineWebServices.java | 6 +- 3 files changed, 5 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/f5b19bed/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index aefc59f..0fe957c 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -429,6 +429,9 @@ Release 2.6.0 - UNRELEASED YARN-2770. Added functionality to renew/cancel TimeLineDelegationToken. (Zhijie Shen via jianhe) + YARN-2818. Removed the now unnecessary user entity injection from Timeline + service given we now have domains. (Zhijie Shen via vinodkv) + OPTIMIZATIONS BUG FIXES http://git-wip-us.apache.org/repos/asf/hadoop/blob/f5b19bed/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/TimelineDataManager.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/TimelineDataManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/TimelineDataManager.java index 3b6aafa..7ef0a67 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/TimelineDataManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/TimelineDataManager.java @@ -109,7 +109,6 @@ public class TimelineDataManager extends AbstractService { EnumSet fields, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineEntities entities = null; - boolean modified = extendFields(fields); entities = store.getEntities( entityType, limit, @@ -130,13 +129,6 @@ public class TimelineDataManager extends AbstractService { if (!timelineACLsManager.checkAccess( callerUGI, ApplicationAccessType.VIEW_APP, entity)) { entitiesItr.remove(); - } else { - // clean up system data - if (modified) { - entity.setPrimaryFilters(null); - } else { - cleanupOwnerInfo(entity); - } } } catch (YarnException e) { LOG.error("Error when verifying access for user " + callerUGI @@ -166,7 +158,6 @@ public class TimelineDataManager extends AbstractService { EnumSet fields, UserGroupInformation callerUGI) throws YarnException, IOException { TimelineEntity entity = null; - boolean modified = extendFields(fields); entity = store.getEntity(entityId, entityType, fields); if (entity != null) { @@ -174,13 +165,6 @@ public class TimelineDataManager extends AbstractService { if (!timelineACLsManager.checkAccess( callerUGI, ApplicationAccessType.VIEW_APP, entity)) { entity = null; - } else { - // clean up the system data - if (modified) { - entity.setPrimaryFilters(null); - } else { - cleanupOwnerInfo(entity); - } } } return entity; @@ -283,8 +267,7 @@ public class TimelineDataManager extends AbstractService { } } catch (Exception e) { // Skip the entity which already exists and was put by others - LOG.error("Skip the timeline entity: " + entityID + ", because " - + e.getMessage()); + LOG.error("Skip the timeline entity: " + entityID, e); TimelinePutResponse.TimelinePutError error = new TimelinePutResponse.TimelinePutError(); error.setEntityId(entityID.getId()); @@ -295,28 +278,6 @@ public class TimelineDataManager extends AbstractService { continue; } - // inject owner information for the access check if this is the first - // time to post the entity, in case it's the admin who is updating - // the timeline data. - try { - if (existingEntity == null) { - injectOwnerInfo(entity, callerUGI.getShortUserName()); - } - } catch (YarnException e) { - // Skip the entity which messes up the primary filter and record the - // error - LOG.error("Skip the timeline entity: " + entityID + ", because " - + e.getMessage()); - TimelinePutResponse.TimelinePutError error = - new TimelinePutResponse.TimelinePutError(); - error.setEntityId(entityID.getId()); - error.setEntityType(entityID.getType()); - error.setErrorCode( - TimelinePutResponse.TimelinePutError.SYSTEM_FILTER_CONFLICT); - errors.add(error); - continue; - } - entityIDs.add(entityID); entitiesToPut.addEntity(entity); if (LOG.isDebugEnabled()) { @@ -394,34 +355,4 @@ public class TimelineDataManager extends AbstractService { } } - private static boolean extendFields(EnumSet fieldEnums) { - boolean modified = false; - if (fieldEnums != null && !fieldEnums.contains(Field.PRIMARY_FILTERS)) { - fieldEnums.add(Field.PRIMARY_FILTERS); - modified = true; - } - return modified; - } - - private static void injectOwnerInfo(TimelineEntity timelineEntity, - String owner) throws YarnException { - if (timelineEntity.getPrimaryFilters() != null && - timelineEntity.getPrimaryFilters().containsKey( - TimelineStore.SystemFilter.ENTITY_OWNER.toString())) { - throw new YarnException( - "User should not use the timeline system filter key: " - + TimelineStore.SystemFilter.ENTITY_OWNER); - } - timelineEntity.addPrimaryFilter( - TimelineStore.SystemFilter.ENTITY_OWNER - .toString(), owner); - } - - private static void cleanupOwnerInfo(TimelineEntity timelineEntity) { - if (timelineEntity.getPrimaryFilters() != null) { - timelineEntity.getPrimaryFilters().remove( - TimelineStore.SystemFilter.ENTITY_OWNER.toString()); - } - } - } http://git-wip-us.apache.org/repos/asf/hadoop/blob/f5b19bed/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/webapp/TestTimelineWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/webapp/TestTimelineWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/webapp/TestTimelineWebServices.java index 8a7f27a..fe2ed5c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/webapp/TestTimelineWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/webapp/TestTimelineWebServices.java @@ -443,11 +443,7 @@ public class TestTimelineWebServices extends JerseyTest { .post(ClientResponse.class, entities); TimelinePutResponse putResposne = response.getEntity(TimelinePutResponse.class); - Assert.assertEquals(1, putResposne.getErrors().size()); - List errors = putResposne.getErrors(); - Assert.assertEquals( - TimelinePutResponse.TimelinePutError.SYSTEM_FILTER_CONFLICT, - errors.get(0).getErrorCode()); + Assert.assertEquals(0, putResposne.getErrors().size()); } @Test