Repository: hadoop
Updated Branches:
refs/heads/branch-2.7 c43cc8fd6 -> 7499981d3
MAPREDUCE-6273. HistoryFileManager should check whether summaryFile exists
to avoid FileNotFoundException causing HistoryFileInfo into MOVE_FAILED
state. Contributed by zhihai xu.
(cherry picked from commit 1ea90144d58443a7431ff33ba49ee19278ebe42b)
(cherry picked from commit b9865cbf3d435903835afa23c74c5e2ecfbba1bc)
Conflicts:
hadoop-mapreduce-project/CHANGES.txt
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7499981d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7499981d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7499981d
Branch: refs/heads/branch-2.7
Commit: 7499981d3cc0aeb140efc6a05253b338638a937a
Parents: c43cc8f
Author: Jason Lowe <[email protected]>
Authored: Thu Oct 29 18:29:45 2015 +0000
Committer: Jason Lowe <[email protected]>
Committed: Thu Oct 29 18:29:45 2015 +0000
----------------------------------------------------------------------
hadoop-mapreduce-project/CHANGES.txt | 4 +++
.../mapreduce/v2/hs/HistoryFileManager.java | 11 +++---
.../mapreduce/v2/hs/TestHistoryFileManager.java | 35 ++++++++++++++++++++
3 files changed, 46 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7499981d/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt
b/hadoop-mapreduce-project/CHANGES.txt
index 42c64fa..c4a4d67 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -48,6 +48,10 @@ Release 2.7.2 - UNRELEASED
MAPREDUCE-6518. Set SO_KEEPALIVE on shuffle connections (Chang Li via
jlowe)
+ MAPREDUCE-6273. HistoryFileManager should check whether summaryFile exists
to
+ avoid FileNotFoundException causing HistoryFileInfo into MOVE_FAILED state.
+ (zhihai xu via devaraj)
+
Release 2.7.1 - 2015-07-06
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7499981d/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java
----------------------------------------------------------------------
diff --git
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java
index 6420303..0b9eaee 100644
---
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java
+++
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/HistoryFileManager.java
@@ -303,8 +303,9 @@ public class HistoryFileManager extends AbstractService {
private JobIndexInfo jobIndexInfo;
private HistoryInfoState state;
- private HistoryFileInfo(Path historyFile, Path confFile, Path summaryFile,
- JobIndexInfo jobIndexInfo, boolean isInDone) {
+ @VisibleForTesting
+ protected HistoryFileInfo(Path historyFile, Path confFile,
+ Path summaryFile, JobIndexInfo jobIndexInfo, boolean isInDone) {
this.historyFile = historyFile;
this.confFile = confFile;
this.summaryFile = summaryFile;
@@ -337,7 +338,8 @@ public class HistoryFileManager extends AbstractService {
+ " historyFile = " + historyFile;
}
- private synchronized void moveToDone() throws IOException {
+ @VisibleForTesting
+ synchronized void moveToDone() throws IOException {
if (LOG.isDebugEnabled()) {
LOG.debug("moveToDone: " + historyFile);
}
@@ -368,7 +370,8 @@ public class HistoryFileManager extends AbstractService {
paths.add(confFile);
}
- if (summaryFile == null) {
+ if (summaryFile == null || !intermediateDoneDirFc.util().exists(
+ summaryFile)) {
LOG.info("No summary file for job: " + jobId);
} else {
String jobSummaryString = getJobSummary(intermediateDoneDirFc,
http://git-wip-us.apache.org/repos/asf/hadoop/blob/7499981d/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestHistoryFileManager.java
----------------------------------------------------------------------
diff --git
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestHistoryFileManager.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestHistoryFileManager.java
index 1c5cc5c..7694de9 100644
---
a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestHistoryFileManager.java
+++
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/TestHistoryFileManager.java
@@ -35,7 +35,12 @@ import org.apache.hadoop.fs.FileContext;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
+import org.apache.hadoop.mapreduce.JobID;
+import org.apache.hadoop.mapreduce.TypeConverter;
+import org.apache.hadoop.mapreduce.v2.api.records.JobId;
+import org.apache.hadoop.mapreduce.v2.hs.HistoryFileManager.HistoryFileInfo;
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
+import org.apache.hadoop.mapreduce.v2.jobhistory.JobIndexInfo;
import org.apache.hadoop.test.CoreTestDriver;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
@@ -221,4 +226,34 @@ public class TestHistoryFileManager {
}
+ @Test
+ public void testHistoryFileInfoSummaryFileNotExist() throws Exception {
+ HistoryFileManagerTest hmTest = new HistoryFileManagerTest();
+ String job = "job_1410889000000_123456";
+ Path summaryFile = new Path(job + ".summary");
+ JobIndexInfo jobIndexInfo = new JobIndexInfo();
+ jobIndexInfo.setJobId(TypeConverter.toYarn(JobID.forName(job)));
+ Configuration conf = dfsCluster.getConfiguration(0);
+ conf.set(JHAdminConfig.MR_HISTORY_DONE_DIR,
+ "/" + UUID.randomUUID());
+ conf.set(JHAdminConfig.MR_HISTORY_INTERMEDIATE_DONE_DIR,
+ "/" + UUID.randomUUID());
+ hmTest.serviceInit(conf);
+ HistoryFileInfo info = hmTest.getHistoryFileInfo(null, null,
+ summaryFile, jobIndexInfo, false);
+ info.moveToDone();
+ Assert.assertFalse(info.didMoveFail());
+ }
+
+ static class HistoryFileManagerTest extends HistoryFileManager {
+ public HistoryFileManagerTest() {
+ super();
+ }
+ public HistoryFileInfo getHistoryFileInfo(Path historyFile,
+ Path confFile, Path summaryFile, JobIndexInfo jobIndexInfo,
+ boolean isInDone) {
+ return new HistoryFileInfo(historyFile, confFile, summaryFile,
+ jobIndexInfo, isInDone);
+ }
+ }
}