This is an automated email from the ASF dual-hosted git repository. abmodi pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new b4097b9 YARN-9744. RollingLevelDBTimelineStore.getEntityByTime fails with NPE. Contributed by Prabhu Joseph. b4097b9 is described below commit b4097b96a39bad6214b01989e7f2fb37dad70793 Author: Abhishek Modi <abm...@apache.org> AuthorDate: Tue Aug 13 19:04:00 2019 +0530 YARN-9744. RollingLevelDBTimelineStore.getEntityByTime fails with NPE. Contributed by Prabhu Joseph. --- .../timeline/RollingLevelDBTimelineStore.java | 55 ++++++++++++---------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/RollingLevelDBTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/RollingLevelDBTimelineStore.java index 9ebcc23..e85505f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/RollingLevelDBTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/RollingLevelDBTimelineStore.java @@ -793,39 +793,42 @@ public class RollingLevelDBTimelineStore extends AbstractService implements entity = getEntity(entityId, entityType, startTime, queryFields, iterator, key, kp.getOffset()); } - // determine if the retrieved entity matches the provided secondary - // filters, and if so add it to the list of entities to return - boolean filterPassed = true; - if (secondaryFilters != null) { - for (NameValuePair filter : secondaryFilters) { - Object v = entity.getOtherInfo().get(filter.getName()); - if (v == null) { - Set<Object> vs = entity.getPrimaryFilters() - .get(filter.getName()); - if (vs == null || !vs.contains(filter.getValue())) { + + if (entity != null) { + // determine if the retrieved entity matches the provided secondary + // filters, and if so add it to the list of entities to return + boolean filterPassed = true; + if (secondaryFilters != null) { + for (NameValuePair filter : secondaryFilters) { + Object v = entity.getOtherInfo().get(filter.getName()); + if (v == null) { + Set<Object> vs = entity.getPrimaryFilters() + .get(filter.getName()); + if (vs == null || !vs.contains(filter.getValue())) { + filterPassed = false; + break; + } + } else if (!v.equals(filter.getValue())) { filterPassed = false; break; } - } else if (!v.equals(filter.getValue())) { - filterPassed = false; - break; } } - } - if (filterPassed) { - if (entity.getDomainId() == null) { - entity.setDomainId(DEFAULT_DOMAIN_ID); - } - if (checkAcl == null || checkAcl.check(entity)) { - // Remove primary filter and other info if they are added for - // matching secondary filters - if (addPrimaryFilters) { - entity.setPrimaryFilters(null); + if (filterPassed) { + if (entity.getDomainId() == null) { + entity.setDomainId(DEFAULT_DOMAIN_ID); } - if (addOtherInfo) { - entity.setOtherInfo(null); + if (checkAcl == null || checkAcl.check(entity)) { + // Remove primary filter and other info if they are added for + // matching secondary filters + if (addPrimaryFilters) { + entity.setPrimaryFilters(null); + } + if (addOtherInfo) { + entity.setOtherInfo(null); + } + entities.addEntity(entity); } - entities.addEntity(entity); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org