From 92ad3bd0998a9d1ad8b9edf2afe7aea491bb6d4d Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Mon, 24 Feb 2020 21:27:31 +0100 Subject: [PATCH] YARN-10143. YARN-10101 broke Yarn logs CLI. Contributed by Adam Antal --- .../ifile/LogAggregationIndexedFileController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java index 00739616d79..2173616fd36 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java @@ -592,8 +592,8 @@ public class LogAggregationIndexedFileController ApplicationId appId = logRequest.getAppId(); String appOwner = logRequest.getAppOwner(); ApplicationAttemptId appAttemptId = logRequest.getAppAttemptId(); - boolean getAllContainers = ((containerIdStr == null || - containerIdStr.isEmpty()) && appAttemptId != null); + boolean getAllContainers = (containerIdStr == null || + containerIdStr.isEmpty()); String nodeIdStr = (nodeId == null || nodeId.isEmpty()) ? null : LogAggregationUtils.getNodeString(nodeId); RemoteIterator nodeFiles = LogAggregationUtils @@ -638,7 +638,8 @@ public class LogAggregationIndexedFileController for (Entry> log : logMeta .getLogMetas().entrySet()) { String currentContainerIdStr = log.getKey(); - if (!belongsToAppAttempt(appAttemptId, currentContainerIdStr)) { + if (appAttemptId != null && + !belongsToAppAttempt(appAttemptId, currentContainerIdStr)) { continue; } ContainerLogMeta meta = new ContainerLogMeta(