YARN-9747. Reduce additional namenode call by EntityGroupFSTimelineStore#cleanLogs. Contributed by Prabhu Joseph.
This commit is contained in:
parent
846848ac4c
commit
89a53c7eb4
@ -469,8 +469,8 @@ void cleanLogs(Path dirpath, long retainMillis)
|
||||
RemoteIterator<FileStatus> iter = list(dirpath);
|
||||
while (iter.hasNext()) {
|
||||
FileStatus stat = iter.next();
|
||||
if (isValidClusterTimeStampDir(stat)) {
|
||||
Path clusterTimeStampPath = stat.getPath();
|
||||
if (isValidClusterTimeStampDir(clusterTimeStampPath)) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user