juncevich commented on code in PR #7134:
URL: https://github.com/apache/ozone/pull/7134#discussion_r1736290911
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerTask.java:
##########
@@ -341,6 +341,16 @@ public List<ContainerBalancerTaskIterationStatusInfo>
getCurrentIterationsStatis
.max()
.orElse(0);
+ // the balancing thread could go to sleep without having initialized
findTargetStrategy, so we check for null here
+ Map<DatanodeDetails, Long> sizeEnteringNodes = Collections.emptyMap();
+ if (findTargetStrategy != null) {
+ sizeEnteringNodes = findTargetStrategy.getSizeEnteringNodes();
+ }
+ Map<DatanodeDetails, Long> sizeLeavingNodes = Collections.emptyMap();
Review Comment:
Maybe it will be better to create empty map only if findSourceStrategy ==
null?
```
if (findSourceStrategy == null) {
sizeLeavingNodes = Collections.emptyMap();
} else {
sizeLeavingNodes = findSourceStrategy.getSizeLeavingNodes();
}
```
--
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]