From 5179f86b21c6a3d2e76f349492e9bc88c432fa71 Mon Sep 17 00:00:00 2001 From: Prabhu Joseph Date: Wed, 14 Aug 2019 11:40:37 +0530 Subject: [PATCH] YARN-9747. Reduce additional namenode call by EntityGroupFSTimelineStore#cleanLogs. --- .../yarn/server/timeline/EntityGroupFSTimelineStore.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java index a5e5b41..cc246d9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timeline-pluginstorage/src/main/java/org/apache/hadoop/yarn/server/timeline/EntityGroupFSTimelineStore.java @@ -469,8 +469,8 @@ void cleanLogs(Path dirpath, long retainMillis) RemoteIterator iter = list(dirpath); while (iter.hasNext()) { FileStatus stat = iter.next(); - Path clusterTimeStampPath = stat.getPath(); - if (isValidClusterTimeStampDir(clusterTimeStampPath)) { + if (isValidClusterTimeStampDir(stat)) { + Path clusterTimeStampPath = stat.getPath(); MutableBoolean appLogDirPresent = new MutableBoolean(false); cleanAppLogDir(clusterTimeStampPath, retainMillis, appLogDirPresent); if (appLogDirPresent.isFalse() && @@ -520,11 +520,9 @@ private void deleteDir(Path path) { } } - private boolean isValidClusterTimeStampDir(Path clusterTimeStampPath) - throws IOException { - FileStatus stat = fs.getFileStatus(clusterTimeStampPath); + private boolean isValidClusterTimeStampDir(FileStatus stat) { return stat.isDirectory() && - StringUtils.isNumeric(clusterTimeStampPath.getName()); + StringUtils.isNumeric(stat.getPath().getName()); } -- 2.7.4 (Apple Git-66)