HDFS-11860. Ozone: SCM: SCMContainerPlacementCapacity#chooseNode sometimes does not remove chosen node from healthy list. Contributed by Xiaoyu Yao.
This commit is contained in:
parent
a0f51ee3d7
commit
56966a0535
|
@ -112,22 +112,22 @@ public final class SCMContainerPlacementCapacity extends SCMCommonPolicy {
|
|||
int firstNodeNdx = getRand().nextInt(healthyNodes.size());
|
||||
int secondNodeNdx = getRand().nextInt(healthyNodes.size());
|
||||
|
||||
DatanodeID chosenID;
|
||||
// There is a possibility that both numbers will be same.
|
||||
// if that is so, we just return the node.
|
||||
if (firstNodeNdx == secondNodeNdx) {
|
||||
return healthyNodes.get(firstNodeNdx);
|
||||
chosenID = healthyNodes.get(firstNodeNdx);
|
||||
} else {
|
||||
DatanodeID firstNodeID = healthyNodes.get(firstNodeNdx);
|
||||
DatanodeID secondNodeID = healthyNodes.get(secondNodeNdx);
|
||||
SCMNodeMetric firstNodeMetric =
|
||||
getNodeManager().getNodeStat(firstNodeID);
|
||||
SCMNodeMetric secondNodeMetric =
|
||||
getNodeManager().getNodeStat(secondNodeID);
|
||||
chosenID = firstNodeMetric.isGreater(secondNodeMetric.get())
|
||||
? firstNodeID : secondNodeID;
|
||||
}
|
||||
|
||||
DatanodeID firstNodeID = healthyNodes.get(firstNodeNdx);
|
||||
DatanodeID secondNodeID = healthyNodes.get(secondNodeNdx);
|
||||
SCMNodeMetric firstNodeMetric = getNodeManager().getNodeStat(firstNodeID);
|
||||
SCMNodeMetric secondNodeMetric = getNodeManager().getNodeStat(secondNodeID);
|
||||
|
||||
DatanodeID chosenID = firstNodeMetric.isGreater(secondNodeMetric.get())
|
||||
? firstNodeID : secondNodeID;
|
||||
|
||||
healthyNodes.remove(chosenID);
|
||||
return chosenID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue