YARN-9816. EntityGroupFSTimelineStore#scanActiveLogs fails when undesired files are present under /ats/active. Contribued by Prabhu Joseph.
This commit is contained in:
parent
68612a0410
commit
44850f6784
@ -376,7 +376,12 @@ int scanActiveLogs(Path dir) throws IOException {
|
||||
AppLogs logs = getAndSetActiveLog(appId, stat.getPath());
|
||||
executor.execute(new ActiveLogParser(logs));
|
||||
} else {
|
||||
logsToScanCount += scanActiveLogs(stat.getPath());
|
||||
if (stat.isDirectory()) {
|
||||
logsToScanCount += scanActiveLogs(stat.getPath());
|
||||
} else {
|
||||
LOG.warn("Ignoring unexpected file in active directory {}",
|
||||
stat.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
return logsToScanCount;
|
||||
|
@ -510,6 +510,23 @@ public void testGetEntityPluginRead() throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanActiveLogsWithInvalidFile() throws Exception {
|
||||
Path invalidFile = new Path(testActiveDirPath, "invalidfile");
|
||||
try {
|
||||
if (!fs.exists(invalidFile)) {
|
||||
fs.createNewFile(invalidFile);
|
||||
}
|
||||
store.scanActiveLogs();
|
||||
} catch (StackOverflowError error) {
|
||||
Assert.fail("EntityLogScanner crashed with StackOverflowError");
|
||||
} finally {
|
||||
if (fs.exists(invalidFile)) {
|
||||
fs.delete(invalidFile, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScanActiveLogsAndMoveToDonePluginRead() throws Exception {
|
||||
EntityGroupFSTimelineStore store = null;
|
||||
|
Loading…
Reference in New Issue
Block a user