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 YARN-1864. Fair Scheduler Dynamic Hierarchical User Queues (Ashwin Shankar
via Sandy Ryza) via Sandy Ryza)
YARN-1362. Distinguish between nodemanager shutdown for decommission vs shutdown
for restart. (Jason Lowe via junping_du)
IMPROVEMENTS IMPROVEMENTS
YARN-1479. Invalid NaN values in Hadoop REST API JSON response (Chen He via 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(); LocalDirsHandlerService getLocalDirsHandler();
ApplicationACLsManager getApplicationACLsManager(); ApplicationACLsManager getApplicationACLsManager();
boolean getDecommissioned();
void setDecommissioned(boolean isDecommissioned);
} }

View File

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

View File

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

View File

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