YARN-6221. Entities missing from ATS when summary log file info got returned to the ATS before the domain log. Contributed by Xiaomin Zhang

This commit is contained in:
Szilard Nemeth 2021-07-27 16:47:41 +02:00
parent f813554769
commit fa0289b022
2 changed files with 27 additions and 1 deletions

View File

@ -808,11 +808,12 @@ private void addSummaryLog(String attemptDirName,
LogInfo log; LogInfo log;
if (isDomainLog) { if (isDomainLog) {
log = new DomainLogInfo(attemptDirName, filename, owner); log = new DomainLogInfo(attemptDirName, filename, owner);
summaryLogs.add(0, log);
} else { } else {
log = new EntityLogInfo(attemptDirName, filename, owner); log = new EntityLogInfo(attemptDirName, filename, owner);
}
summaryLogs.add(log); summaryLogs.add(log);
} }
}
private synchronized void addDetailLog(String attemptDirName, private synchronized void addDetailLog(String attemptDirName,
String filename, String owner) { String filename, String owner) {

View File

@ -226,6 +226,31 @@ store.new AppLogs(mainTestAppId, mainTestAppDirPath,
} }
} }
@Test
public void testAppLogsDomainLogLastlyScanned() throws Exception {
EntityGroupFSTimelineStore.AppLogs appLogs =
store.new AppLogs(mainTestAppId, mainTestAppDirPath,
AppState.COMPLETED);
Path attemptDirPath = new Path(new Path(testActiveDirPath,
mainTestAppId.toString()),
getAttemptDirName(mainTestAppId));
//Delete the domain log from AppDirPath so first scan won't find it
fs.delete(new Path(attemptDirPath, TEST_DOMAIN_LOG_FILE_NAME), false);
appLogs.scanForLogs();
List<LogInfo> summaryLogs = appLogs.getSummaryLogs();
assertEquals(1, summaryLogs.size());
assertEquals(TEST_SUMMARY_LOG_FILE_NAME, summaryLogs.get(0).getFilename());
//Generate the domain log
FSDataOutputStream out = fs.create(
new Path(attemptDirPath, TEST_DOMAIN_LOG_FILE_NAME));
out.close();
appLogs.scanForLogs();
assertEquals(2, summaryLogs.size());
assertEquals(TEST_DOMAIN_LOG_FILE_NAME, summaryLogs.get(0).getFilename());
}
@Test @Test
public void testMoveToDone() throws Exception { public void testMoveToDone() throws Exception {
EntityGroupFSTimelineStore.AppLogs appLogs = EntityGroupFSTimelineStore.AppLogs appLogs =