YARN-295. Fixed a race condition in ResourceManager RMAppAttempt state machine. Contributed by Mayank Bansal.

svn merge --ignore-ancestry -c 1501856 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1501857 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-07-10 17:09:41 +00:00
parent 56f8a1a6f3
commit 66b20f8486
3 changed files with 21 additions and 0 deletions

View File

@ -46,6 +46,9 @@ Release 2.1.1-beta - UNRELEASED
YARN-368. Fixed a typo in error message in Auxiliary services. (Albert Chu
via vinodkv)
YARN-295. Fixed a race condition in ResourceManager RMAppAttempt state
machine. (Mayank Bansal via vinodkv)
Release 2.1.0-beta - 2013-07-02
INCOMPATIBLE CHANGES

View File

@ -245,6 +245,10 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
.addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.KILLED,
RMAppAttemptEventType.KILL, new KillAllocatedAMTransition())
.addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.FAILED,
RMAppAttemptEventType.CONTAINER_FINISHED,
new AMContainerCrashedTransition())
// Transitions from LAUNCHED State
.addTransition(RMAppAttemptState.LAUNCHED, RMAppAttemptState.RUNNING,
RMAppAttemptEventType.REGISTERED, new AMRegisteredTransition())

View File

@ -654,6 +654,20 @@ public class TestRMAppAttemptTransitions {
testAppAttemptFailedState(amContainer, diagnostics);
}
@Test
public void testAMCrashAtAllocated() {
Container amContainer = allocateApplicationAttempt();
String containerDiagMsg = "some error";
int exitCode = 123;
ContainerStatus cs =
BuilderUtils.newContainerStatus(amContainer.getId(),
ContainerState.COMPLETE, containerDiagMsg, exitCode);
applicationAttempt.handle(new RMAppAttemptContainerFinishedEvent(
applicationAttempt.getAppAttemptId(), cs));
assertEquals(RMAppAttemptState.FAILED,
applicationAttempt.getAppAttemptState());
}
@Test
public void testRunningToFailed() {
Container amContainer = allocateApplicationAttempt();