YARN-3207. Secondary filter matches entites which do not have the key

being filtered for. Contributed by Zhijie Shen
This commit is contained in:
Xuan 2015-02-17 18:17:29 -08:00
parent 685af8a3d0
commit 57db50cbe3
3 changed files with 7 additions and 1 deletions

View File

@ -608,6 +608,9 @@ Release 2.7.0 - UNRELEASED
YARN-2749. Fix some testcases from TestLogAggregationService fails in trunk. YARN-2749. Fix some testcases from TestLogAggregationService fails in trunk.
(Xuan Gong via junping_du) (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 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -672,7 +672,7 @@ private TimelineEntities getEntityByTime(byte[] base,
if (v == null) { if (v == null) {
Set<Object> vs = entity.getPrimaryFilters() Set<Object> vs = entity.getPrimaryFilters()
.get(filter.getName()); .get(filter.getName());
if (vs != null && !vs.contains(filter.getValue())) { if (vs == null || !vs.contains(filter.getValue())) {
filterPassed = false; filterPassed = false;
break; break;
} }

View File

@ -767,6 +767,9 @@ public void testGetEntitiesWithSecondaryFilters() throws IOException {
entities = getEntitiesWithFilters("type_1", userFilter, badTestingFilters); entities = getEntitiesWithFilters("type_1", userFilter, badTestingFilters);
assertEquals(0, entities.size()); assertEquals(0, entities.size());
entities = getEntitiesWithFilters("type_5", null, badTestingFilters);
assertEquals(0, entities.size());
} }
public void testGetEvents() throws IOException { public void testGetEvents() throws IOException {