Skip to content

Commit d035755

Browse files
committed
MAPREDUCE-5145. Changed default max-attempts to be more than one for MR jobs inline with YARN. Contributed by Zhijie Shen.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1477889 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8184022 commit d035755

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

hadoop-mapreduce-project/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ Release 2.0.5-beta - UNRELEASED
215215
MAPREDUCE-5069. add concrete common implementations of
216216
CombineFileInputFormat (Sangjin Lee via bobby)
217217

218+
MAPREDUCE-5145. Changed default max-attempts to be more than one for MR jobs
219+
inline with YARN. (Zhijie Shen via vinodkv)
220+
218221
OPTIMIZATIONS
219222

220223
MAPREDUCE-4974. Optimising the LineRecordReader initialize() method

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestStagingCleanup.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public void testDeletionofStaging() throws IOException {
9090
JobId jobid = recordFactory.newRecordInstance(JobId.class);
9191
jobid.setAppId(appId);
9292
ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
93+
Assert.assertTrue(MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS > 1);
9394
MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
9495
JobStateInternal.RUNNING, MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS);
9596
appMaster.init(conf);
@@ -116,8 +117,9 @@ public void testNoDeletionofStagingOnReboot() throws IOException {
116117
appId.setId(0);
117118
attemptId.setApplicationId(appId);
118119
ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
120+
Assert.assertTrue(MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS > 1);
119121
MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
120-
JobStateInternal.REBOOT, 4);
122+
JobStateInternal.REBOOT, MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS);
121123
appMaster.init(conf);
122124
appMaster.start();
123125
//shutdown the job, not the lastRetry
@@ -144,7 +146,7 @@ public void testDeletionofStagingOnReboot() throws IOException {
144146
attemptId.setApplicationId(appId);
145147
ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
146148
MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
147-
JobStateInternal.REBOOT, MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS);
149+
JobStateInternal.REBOOT, 1); //no retry
148150
appMaster.init(conf);
149151
appMaster.start();
150152
//shutdown the job, is lastRetry
@@ -201,8 +203,7 @@ public void testDeletionofStagingOnKillLastTry() throws IOException {
201203
JobId jobid = recordFactory.newRecordInstance(JobId.class);
202204
jobid.setAppId(appId);
203205
ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
204-
MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
205-
MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS);
206+
MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc, 1); //no retry
206207
appMaster.init(conf);
207208
//simulate the process being killed
208209
MRAppMaster.MRAppMasterShutdownHook hook =

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,6 @@ public interface MRJobConfig {
677677
*/
678678
public static final String MR_AM_MAX_ATTEMPTS = "mapreduce.am.max-attempts";
679679

680-
public static final int DEFAULT_MR_AM_MAX_ATTEMPTS = 1;
680+
public static final int DEFAULT_MR_AM_MAX_ATTEMPTS = 2;
681681

682682
}

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,10 +816,11 @@
816816

817817
<property>
818818
<name>mapreduce.am.max-attempts</name>
819-
<value>1</value>
819+
<value>2</value>
820820
<description>The maximum number of application attempts. It is a
821821
application-specific setting. It should not be larger than the global number
822-
set by resourcemanager. Otherwise, it will be override.</description>
822+
set by resourcemanager. Otherwise, it will be override. The default number is
823+
set to 2, to allow at least one retry for AM.</description>
823824
</property>
824825

825826
<!-- Job Notification Configuration -->

0 commit comments

Comments
 (0)