Skip to content

Commit

Permalink
YARN-3212. RMNode State Transition Update with DECOMMISSIONING state.…
Browse files Browse the repository at this point in the history
… (Junping Du via wangda)
  • Loading branch information
wangdatan committed Sep 18, 2015
1 parent 3f42753 commit 9bc913a
Show file tree
Hide file tree
Showing 7 changed files with 513 additions and 169 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Expand Up @@ -197,6 +197,9 @@ Release 2.8.0 - UNRELEASED
YARN-4034. Render cluster Max Priority in scheduler metrics in RM web YARN-4034. Render cluster Max Priority in scheduler metrics in RM web
UI. (Rohith Sharma K S via jianhe) UI. (Rohith Sharma K S via jianhe)


YARN-3212. RMNode State Transition Update with DECOMMISSIONING state.
(Junping Du via wangda)

IMPROVEMENTS IMPROVEMENTS


YARN-644. Basic null check is not performed on passed in arguments before YARN-644. Basic null check is not performed on passed in arguments before
Expand Down
Expand Up @@ -399,7 +399,7 @@ public void refreshNodesGracefully(Configuration conf) throws IOException,
NodeId nodeId = entry.getKey(); NodeId nodeId = entry.getKey();
if (!isValidNode(nodeId.getHost())) { if (!isValidNode(nodeId.getHost())) {
this.rmContext.getDispatcher().getEventHandler().handle( this.rmContext.getDispatcher().getEventHandler().handle(
new RMNodeEvent(nodeId, RMNodeEventType.DECOMMISSION_WITH_TIMEOUT)); new RMNodeEvent(nodeId, RMNodeEventType.GRACEFUL_DECOMMISSION));
} else { } else {
// Recommissioning the nodes // Recommissioning the nodes
if (entry.getValue().getState() == NodeState.DECOMMISSIONING if (entry.getValue().getState() == NodeState.DECOMMISSIONING
Expand Down
Expand Up @@ -44,6 +44,7 @@
import org.apache.hadoop.yarn.api.records.ContainerStatus; import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.NodeLabel; import org.apache.hadoop.yarn.api.records.NodeLabel;
import org.apache.hadoop.yarn.api.records.NodeState;
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.exceptions.YarnException;
Expand Down Expand Up @@ -399,8 +400,10 @@ public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)


NodeId nodeId = remoteNodeStatus.getNodeId(); NodeId nodeId = remoteNodeStatus.getNodeId();


// 1. Check if it's a valid (i.e. not excluded) node // 1. Check if it's a valid (i.e. not excluded) node, if not, see if it is
if (!this.nodesListManager.isValidNode(nodeId.getHost())) { // in decommissioning.
if (!this.nodesListManager.isValidNode(nodeId.getHost())
&& !isNodeInDecommissioning(nodeId)) {
String message = String message =
"Disallowed NodeManager nodeId: " + nodeId + " hostname: " "Disallowed NodeManager nodeId: " + nodeId + " hostname: "
+ nodeId.getHost(); + nodeId.getHost();
Expand Down Expand Up @@ -486,6 +489,19 @@ public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
return nodeHeartBeatResponse; return nodeHeartBeatResponse;
} }


/**
* Check if node in decommissioning state.
* @param nodeId
*/
private boolean isNodeInDecommissioning(NodeId nodeId) {
RMNode rmNode = this.rmContext.getRMNodes().get(nodeId);
if (rmNode != null &&
rmNode.getState().equals(NodeState.DECOMMISSIONING)) {
return true;
}
return false;
}

@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public UnRegisterNodeManagerResponse unRegisterNodeManager( public UnRegisterNodeManagerResponse unRegisterNodeManager(
Expand Down
Expand Up @@ -24,7 +24,7 @@ public enum RMNodeEventType {


// Source: AdminService // Source: AdminService
DECOMMISSION, DECOMMISSION,
DECOMMISSION_WITH_TIMEOUT, GRACEFUL_DECOMMISSION,
RECOMMISSION, RECOMMISSION,


// Source: AdminService, ResourceTrackerService // Source: AdminService, ResourceTrackerService
Expand Down

0 comments on commit 9bc913a

Please sign in to comment.