amaliujia commented on code in PR #11917:
URL: https://github.com/apache/ozone/pull/11917#discussion_r4477050176
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java:
##########
@@ -127,6 +127,19 @@ protected List<DatanodeDetails> chooseDatanodesInternal(
*/
@Override
public DatanodeDetails chooseNode(List<DatanodeDetails> healthyNodes) {
+ return chooseNode(healthyNodes, null);
Review Comment:
`null` is odd. Does it worth also defining a `empty` for StorageType and use
`empty` here.
We do not have StorageType.empty though in
https://github.com/apache/ozone/pull/6989
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/placement/algorithms/SCMContainerPlacementCapacity.java:
##########
@@ -143,8 +156,10 @@ public DatanodeDetails chooseNode(List<DatanodeDetails>
healthyNodes) {
getNodeManager().getNodeStat(firstNodeDetails);
SCMNodeMetric secondNodeMetric =
getNodeManager().getNodeStat(secondNodeDetails);
- datanodeDetails = !firstNodeMetric.isGreater(secondNodeMetric.get())
- ? firstNodeDetails : secondNodeDetails;
+ boolean firstIsFuller = storageType == null
+ ? firstNodeMetric.isGreater(secondNodeMetric.get())
+ : firstNodeMetric.isGreater(secondNodeMetric.get(), storageType);
+ datanodeDetails = !firstIsFuller ? firstNodeDetails : secondNodeDetails;
Review Comment:
nit: extract the code here to a function with comment to document the
capacity based algorithm. Embedded inside other functions make this core logic
not very visible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]