YARN-4047. ClientRMService getApplications has high scheduler lock contention. Contributed by Jason Lowe (cherry picked from commit 7a445fcfabcf9c6aae219051f65d3f6cb8feb87c)
(cherry picked from commit 703fa1b141a98449746bd6fb3b144e74d964d1f5) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2b526ba7 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2b526ba7 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2b526ba7 Branch: refs/heads/branch-2.6.1 Commit: 2b526ba75780ac61ba6d0bcb36044c6f7d9b6633 Parents: d59bf81 Author: Jian He <jia...@apache.org> Authored: Thu Aug 13 16:02:57 2015 -0700 Committer: Vinod Kumar Vavilapalli <vino...@apache.org> Committed: Tue Sep 8 22:57:35 2015 -0700 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 +++ .../yarn/server/resourcemanager/ClientRMService.java | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b526ba7/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index ac114fa..7ff9d72 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -202,6 +202,9 @@ Release 2.6.1 - UNRELEASED YARN-3999. RM hangs on draing events. (Jian He via xgong) + YARN-4047. ClientRMService getApplications has high scheduler lock contention. + (Jason Lowe via jianhe) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b526ba7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.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/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index abd08f1..6661d04 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -738,13 +738,9 @@ public class ClientRMService extends AbstractService implements RMApp application = appsIter.next(); // Check if current application falls under the specified scope - boolean allowAccess = checkAccess(callerUGI, application.getUser(), - ApplicationAccessType.VIEW_APP, application); if (scope == ApplicationsRequestScope.OWN && !callerUGI.getUserName().equals(application.getUser())) { continue; - } else if (scope == ApplicationsRequestScope.VIEWABLE && !allowAccess) { - continue; } if (applicationTypes != null && !applicationTypes.isEmpty()) { @@ -793,6 +789,13 @@ public class ClientRMService extends AbstractService implements } } + // checkAccess can grab the scheduler lock so call it last + boolean allowAccess = checkAccess(callerUGI, application.getUser(), + ApplicationAccessType.VIEW_APP, application); + if (scope == ApplicationsRequestScope.VIEWABLE && !allowAccess) { + continue; + } + reports.add(application.createAndGetApplicationReport( callerUGI.getUserName(), allowAccess)); }