YARN-820. Fixed an invalid state transition in NodeManager caused by failing resource localization. Contributed by Mayank Bansal.
svn merge --ignore-ancestry -c 1503947 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1503948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14adc33eb4
commit
0623ee954a
|
@ -48,6 +48,9 @@ Release 2.1.1-beta - UNRELEASED
|
||||||
YARN-661. Fixed NM to cleanup users' local directories correctly when
|
YARN-661. Fixed NM to cleanup users' local directories correctly when
|
||||||
starting up. (Omkar Vinit Joshi via vinodkv)
|
starting up. (Omkar Vinit Joshi via vinodkv)
|
||||||
|
|
||||||
|
YARN-820. Fixed an invalid state transition in NodeManager caused by failing
|
||||||
|
resource localization. (Mayank Bansal via vinodkv)
|
||||||
|
|
||||||
Release 2.1.0-beta - 2013-07-02
|
Release 2.1.0-beta - 2013-07-02
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -290,6 +290,11 @@ public class ContainerImpl implements Container {
|
||||||
.addTransition(ContainerState.DONE, ContainerState.DONE,
|
.addTransition(ContainerState.DONE, ContainerState.DONE,
|
||||||
ContainerEventType.UPDATE_DIAGNOSTICS_MSG,
|
ContainerEventType.UPDATE_DIAGNOSTICS_MSG,
|
||||||
UPDATE_DIAGNOSTICS_TRANSITION)
|
UPDATE_DIAGNOSTICS_TRANSITION)
|
||||||
|
// This transition may result when
|
||||||
|
// we notify container of failed localization if localizer thread (for
|
||||||
|
// that container) fails for some reason
|
||||||
|
.addTransition(ContainerState.DONE, ContainerState.DONE,
|
||||||
|
ContainerEventType.RESOURCE_FAILED)
|
||||||
|
|
||||||
// create the topology tables
|
// create the topology tables
|
||||||
.installTopology();
|
.installTopology();
|
||||||
|
|
|
@ -112,12 +112,17 @@ public class LocalizedResource implements EventHandler<ResourceEvent> {
|
||||||
.append(getState() == ResourceState.LOCALIZED
|
.append(getState() == ResourceState.LOCALIZED
|
||||||
? getLocalPath() + "," + getSize()
|
? getLocalPath() + "," + getSize()
|
||||||
: "pending").append(",[");
|
: "pending").append(",[");
|
||||||
|
try {
|
||||||
|
this.readLock.lock();
|
||||||
for (ContainerId c : ref) {
|
for (ContainerId c : ref) {
|
||||||
sb.append("(").append(c.toString()).append(")");
|
sb.append("(").append(c.toString()).append(")");
|
||||||
}
|
}
|
||||||
sb.append("],").append(getTimestamp()).append(",")
|
sb.append("],").append(getTimestamp()).append(",").append(getState())
|
||||||
.append(getState()).append("}");
|
.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
} finally {
|
||||||
|
this.readLock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void release(ContainerId container) {
|
private void release(ContainerId container) {
|
||||||
|
|
|
@ -241,6 +241,32 @@ public class TestContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// mocked generic
|
||||||
|
public void testLocalizationFailureAtDone() throws Exception {
|
||||||
|
WrappedContainer wc = null;
|
||||||
|
try {
|
||||||
|
wc = new WrappedContainer(6, 314159265358979L, 4344, "yak");
|
||||||
|
wc.initContainer();
|
||||||
|
wc.localizeResources();
|
||||||
|
wc.launchContainer();
|
||||||
|
reset(wc.localizerBus);
|
||||||
|
wc.containerSuccessful();
|
||||||
|
wc.containerResourcesCleanup();
|
||||||
|
assertEquals(ContainerState.DONE, wc.c.getContainerState());
|
||||||
|
// Now in DONE, issue RESOURCE_FAILED as done by LocalizeRunner
|
||||||
|
wc.resourceFailedContainer();
|
||||||
|
// Verify still in DONE
|
||||||
|
assertEquals(ContainerState.DONE, wc.c.getContainerState());
|
||||||
|
verifyCleanupCall(wc);
|
||||||
|
} finally {
|
||||||
|
if (wc != null) {
|
||||||
|
wc.finished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked") // mocked generic
|
@SuppressWarnings("unchecked") // mocked generic
|
||||||
public void testCleanupOnKillRequest() throws Exception {
|
public void testCleanupOnKillRequest() throws Exception {
|
||||||
|
@ -624,6 +650,11 @@ public class TestContainer {
|
||||||
drainDispatcherEvents();
|
drainDispatcherEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resourceFailedContainer() {
|
||||||
|
c.handle(new ContainerEvent(cId, ContainerEventType.RESOURCE_FAILED));
|
||||||
|
drainDispatcherEvents();
|
||||||
|
}
|
||||||
|
|
||||||
// Localize resources
|
// Localize resources
|
||||||
// Skip some resources so as to consider them failed
|
// Skip some resources so as to consider them failed
|
||||||
public Map<Path, List<String>> doLocalizeResources(
|
public Map<Path, List<String>> doLocalizeResources(
|
||||||
|
|
Loading…
Reference in New Issue