YARN-9747. Reduce additional namenode call by EntityGroupFSTimelineStore#cleanLogs. Contributed by Prabhu Joseph.

This commit is contained in:
bibinchundatt 2019-08-14 13:46:23 +05:30
parent 846848ac4c
commit 89a53c7eb4
1 changed files with 4 additions and 6 deletions

View File

@ -469,8 +469,8 @@ public class EntityGroupFSTimelineStore extends CompositeService
RemoteIterator<FileStatus> iter = list(dirpath); RemoteIterator<FileStatus> iter = list(dirpath);
while (iter.hasNext()) { while (iter.hasNext()) {
FileStatus stat = iter.next(); FileStatus stat = iter.next();
Path clusterTimeStampPath = stat.getPath(); if (isValidClusterTimeStampDir(stat)) {
if (isValidClusterTimeStampDir(clusterTimeStampPath)) { Path clusterTimeStampPath = stat.getPath();
MutableBoolean appLogDirPresent = new MutableBoolean(false); MutableBoolean appLogDirPresent = new MutableBoolean(false);
cleanAppLogDir(clusterTimeStampPath, retainMillis, appLogDirPresent); cleanAppLogDir(clusterTimeStampPath, retainMillis, appLogDirPresent);
if (appLogDirPresent.isFalse() && if (appLogDirPresent.isFalse() &&
@ -520,11 +520,9 @@ public class EntityGroupFSTimelineStore extends CompositeService
} }
} }
private boolean isValidClusterTimeStampDir(Path clusterTimeStampPath) private boolean isValidClusterTimeStampDir(FileStatus stat) {
throws IOException {
FileStatus stat = fs.getFileStatus(clusterTimeStampPath);
return stat.isDirectory() && return stat.isDirectory() &&
StringUtils.isNumeric(clusterTimeStampPath.getName()); StringUtils.isNumeric(stat.getPath().getName());
} }