MAPREDUCE-2990. Fixed display of NodeHealthStatus. Contributed by Subroto Sanyal.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1175351 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d09ceac1f7
commit
5ace0cabe5
@ -1409,6 +1409,9 @@ Release 0.23.0 - Unreleased
|
|||||||
MAPREDUCE-2691. Increase threadpool size for launching containers in
|
MAPREDUCE-2691. Increase threadpool size for launching containers in
|
||||||
MapReduce ApplicationMaster. (vinodkv via acmurthy)
|
MapReduce ApplicationMaster. (vinodkv via acmurthy)
|
||||||
|
|
||||||
|
MAPREDUCE-2990. Fixed display of NodeHealthStatus. (Subroto Sanyal via
|
||||||
|
acmurthy)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -147,6 +147,7 @@ public RMNodeImpl(NodeId nodeId, RMContext context, String hostName,
|
|||||||
this.httpAddress = hostName + ":" + httpPort;;
|
this.httpAddress = hostName + ":" + httpPort;;
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.nodeHealthStatus.setIsNodeHealthy(true);
|
this.nodeHealthStatus.setIsNodeHealthy(true);
|
||||||
|
this.nodeHealthStatus.setHealthReport("Healthy");
|
||||||
this.nodeHealthStatus.setLastHealthReportTime(System.currentTimeMillis());
|
this.nodeHealthStatus.setLastHealthReportTime(System.currentTimeMillis());
|
||||||
|
|
||||||
this.latestHeartBeatResponse.setResponseId(0);
|
this.latestHeartBeatResponse.setResponseId(0);
|
||||||
@ -222,6 +223,18 @@ public NodeHealthStatus getNodeHealthStatus() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setNodeHealthStatus(NodeHealthStatus status)
|
||||||
|
{
|
||||||
|
this.writeLock.lock();
|
||||||
|
try {
|
||||||
|
this.nodeHealthStatus.setHealthReport(status.getHealthReport());
|
||||||
|
this.nodeHealthStatus.setIsNodeHealthy(status.getIsNodeHealthy());
|
||||||
|
this.nodeHealthStatus.setLastHealthReportTime(status.getLastHealthReportTime());
|
||||||
|
} finally {
|
||||||
|
this.writeLock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RMNodeState getState() {
|
public RMNodeState getState() {
|
||||||
this.readLock.lock();
|
this.readLock.lock();
|
||||||
@ -345,7 +358,10 @@ public RMNodeState transition(RMNodeImpl rmNode, RMNodeEvent event) {
|
|||||||
// Switch the last heartbeatresponse.
|
// Switch the last heartbeatresponse.
|
||||||
rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
|
rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
|
||||||
|
|
||||||
if (!statusEvent.getNodeHealthStatus().getIsNodeHealthy()) {
|
NodeHealthStatus remoteNodeHealthStatus =
|
||||||
|
statusEvent.getNodeHealthStatus();
|
||||||
|
rmNode.setNodeHealthStatus(remoteNodeHealthStatus);
|
||||||
|
if (!remoteNodeHealthStatus.getIsNodeHealthy()) {
|
||||||
// Inform the scheduler
|
// Inform the scheduler
|
||||||
rmNode.context.getDispatcher().getEventHandler().handle(
|
rmNode.context.getDispatcher().getEventHandler().handle(
|
||||||
new NodeRemovedSchedulerEvent(rmNode));
|
new NodeRemovedSchedulerEvent(rmNode));
|
||||||
@ -392,8 +408,9 @@ public RMNodeState transition(RMNodeImpl rmNode, RMNodeEvent event) {
|
|||||||
|
|
||||||
// Switch the last heartbeatresponse.
|
// Switch the last heartbeatresponse.
|
||||||
rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
|
rmNode.latestHeartBeatResponse = statusEvent.getLatestResponse();
|
||||||
|
NodeHealthStatus remoteNodeHealthStatus = statusEvent.getNodeHealthStatus();
|
||||||
if (statusEvent.getNodeHealthStatus().getIsNodeHealthy()) {
|
rmNode.setNodeHealthStatus(remoteNodeHealthStatus);
|
||||||
|
if (remoteNodeHealthStatus.getIsNodeHealthy()) {
|
||||||
rmNode.context.getDispatcher().getEventHandler().handle(
|
rmNode.context.getDispatcher().getEventHandler().handle(
|
||||||
new NodeAddedSchedulerEvent(rmNode));
|
new NodeAddedSchedulerEvent(rmNode));
|
||||||
return RMNodeState.RUNNING;
|
return RMNodeState.RUNNING;
|
||||||
|
@ -18,12 +18,16 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager;
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.net.NetworkTopology;
|
import org.apache.hadoop.net.NetworkTopology;
|
||||||
|
import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
|
||||||
import org.apache.hadoop.yarn.api.records.Priority;
|
import org.apache.hadoop.yarn.api.records.Priority;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store;
|
import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store;
|
||||||
@ -153,6 +157,23 @@ public void testResourceAllocation() throws IOException {
|
|||||||
|
|
||||||
LOG.info("--- END: testResourceAllocation ---");
|
LOG.info("--- END: testResourceAllocation ---");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNodeHealthReportIsNotNull() throws Exception{
|
||||||
|
String host1 = "host1";
|
||||||
|
final int memory = 4 * 1024;
|
||||||
|
org.apache.hadoop.yarn.server.resourcemanager.NodeManager nm1 =
|
||||||
|
registerNode(host1, 1234, 2345, NetworkTopology.DEFAULT_RACK, memory);
|
||||||
|
nm1.heartbeat();
|
||||||
|
nm1.heartbeat();
|
||||||
|
Collection<RMNode> values = resourceManager.getRMContext().getRMNodes().values();
|
||||||
|
for (RMNode ni : values)
|
||||||
|
{
|
||||||
|
NodeHealthStatus nodeHealthStatus = ni.getNodeHealthStatus();
|
||||||
|
String healthReport = nodeHealthStatus.getHealthReport();
|
||||||
|
assertNotNull(healthReport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void checkResourceUsage(
|
private void checkResourceUsage(
|
||||||
org.apache.hadoop.yarn.server.resourcemanager.NodeManager... nodes ) {
|
org.apache.hadoop.yarn.server.resourcemanager.NodeManager... nodes ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user