YARN-1362. Distinguish between nodemanager shutdown for decommission vs shutdown for restart. (Contributed by Jason Lowe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1594421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Junping Du 2014-05-14 00:20:53 +00:00
parent 45b42676f9
commit b29434a5c8
5 changed files with 21 additions and 1 deletions

View File

@ -26,6 +26,9 @@ Release 2.5.0 - UNRELEASED
YARN-1864. Fair Scheduler Dynamic Hierarchical User Queues (Ashwin Shankar
via Sandy Ryza)
YARN-1362. Distinguish between nodemanager shutdown for decommission vs shutdown
for restart. (Jason Lowe via junping_du)
IMPROVEMENTS
YARN-1479. Invalid NaN values in Hadoop REST API JSON response (Chen He via

View File

@ -66,4 +66,8 @@ public interface Context {
LocalDirsHandlerService getLocalDirsHandler();
ApplicationACLsManager getApplicationACLsManager();
boolean getDecommissioned();
void setDecommissioned(boolean isDecommissioned);
}

View File

@ -272,6 +272,7 @@ public class NodeManager extends CompositeService
private WebServer webServer;
private final NodeHealthStatus nodeHealthStatus = RecordFactoryProvider
.getRecordFactory(null).newRecordInstance(NodeHealthStatus.class);
private boolean isDecommissioned = false;
public NMContext(NMContainerTokenSecretManager containerTokenSecretManager,
NMTokenSecretManagerInNM nmTokenSecretManager,
@ -349,6 +350,16 @@ public class NodeManager extends CompositeService
public ApplicationACLsManager getApplicationACLsManager() {
return aclsManager;
}
@Override
public boolean getDecommissioned() {
return isDecommissioned;
}
@Override
public void setDecommissioned(boolean isDecommissioned) {
this.isDecommissioned = isDecommissioned;
}
}

View File

@ -493,6 +493,7 @@ public class NodeStatusUpdaterImpl extends AbstractService implements
+ " hence shutting down.");
LOG.warn("Message from ResourceManager: "
+ response.getDiagnosticsMessage());
context.setDecommissioned(true);
dispatcher.getEventHandler().handle(
new NodeManagerEvent(NodeManagerEventType.SHUTDOWN));
break;

View File

@ -930,6 +930,7 @@ public class TestNodeStatusUpdater {
Thread.sleep(500);
}
Assert.assertFalse(heartBeatID < 1);
Assert.assertTrue(nm.getNMContext().getDecommissioned());
// NM takes a while to reach the STOPPED state.
waitCount = 0;