MAPREDUCE-7191. JobHistoryServer should log exception when loading/parsing history file failed. Contributed by Jiandan Yang.

(cherry picked from commit f0605146b3)
This commit is contained in:
Weiwei Yang 2019-03-11 15:02:54 +08:00
parent cfaf21a4ba
commit 9a2b24642d
1 changed files with 9 additions and 6 deletions

View File

@ -380,17 +380,20 @@ public class CompletedJob implements org.apache.hadoop.mapreduce.v2.app.job.Job
parser = createJobHistoryParser(historyFileAbsolute); parser = createJobHistoryParser(historyFileAbsolute);
this.jobInfo = parser.parse(); this.jobInfo = parser.parse();
} catch (IOException e) { } catch (IOException e) {
throw new YarnRuntimeException("Could not load history file " String errorMsg = "Could not load history file " + historyFileAbsolute;
+ historyFileAbsolute, e); LOG.warn(errorMsg, e);
throw new YarnRuntimeException(errorMsg, e);
} }
IOException parseException = parser.getParseException(); IOException parseException = parser.getParseException();
if (parseException != null) { if (parseException != null) {
throw new YarnRuntimeException( String errorMsg = "Could not parse history file " + historyFileAbsolute;
"Could not parse history file " + historyFileAbsolute, LOG.warn(errorMsg, parseException);
parseException); throw new YarnRuntimeException(errorMsg, parseException);
} }
} else { } else {
throw new IOException("History file not found"); String errorMsg = "History file not found";
LOG.warn(errorMsg);
throw new IOException(errorMsg);
} }
if (loadTasks) { if (loadTasks) {
loadAllTasks(); loadAllTasks();