From ba18adbb27c37a8fa92223a412ce65eaa462d18b Mon Sep 17 00:00:00 2001 From: Xuan Date: Tue, 17 Feb 2015 18:17:29 -0800 Subject: [PATCH] YARN-3207. Secondary filter matches entites which do not have the key being filtered for. Contributed by Zhijie Shen (cherry picked from commit 57db50cbe3ce42618ad6d6869ae337d15b261f4e) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../hadoop/yarn/server/timeline/LeveldbTimelineStore.java | 2 +- .../hadoop/yarn/server/timeline/TimelineStoreTestUtils.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 0b97db66ba3..7ac4e33fd02 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -572,6 +572,9 @@ Release 2.7.0 - UNRELEASED YARN-2749. Fix some testcases from TestLogAggregationService fails in trunk. (Xuan Gong via junping_du) + YARN-3207. Secondary filter matches entites which do not have the key being + filtered for. (Zhijie Shen via xgong) + Release 2.6.0 - 2014-11-18 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/LeveldbTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/LeveldbTimelineStore.java index 5f153bdea67..9fd2cfc95b3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/LeveldbTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/LeveldbTimelineStore.java @@ -672,7 +672,7 @@ public class LeveldbTimelineStore extends AbstractService if (v == null) { Set vs = entity.getPrimaryFilters() .get(filter.getName()); - if (vs != null && !vs.contains(filter.getValue())) { + if (vs == null || !vs.contains(filter.getValue())) { filterPassed = false; break; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/TimelineStoreTestUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/TimelineStoreTestUtils.java index 6f15b9245b8..c99786df3ed 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/TimelineStoreTestUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/timeline/TimelineStoreTestUtils.java @@ -767,6 +767,9 @@ public class TimelineStoreTestUtils { entities = getEntitiesWithFilters("type_1", userFilter, badTestingFilters); assertEquals(0, entities.size()); + + entities = getEntitiesWithFilters("type_5", null, badTestingFilters); + assertEquals(0, entities.size()); } public void testGetEvents() throws IOException {