sravani-revuri commented on code in PR #9839:
URL: https://github.com/apache/ozone/pull/9839#discussion_r2894124773
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancerSelectionCriteria.java:
##########
@@ -158,6 +160,10 @@ private Comparator<ContainerID>
orderContainersByUsedBytes() {
public boolean shouldBeExcluded(ContainerID containerID,
DatanodeDetails node, long sizeMovedAlready) {
ContainerInfo container;
+ //If includeContainers is specified, exclude containers not in the include
list
+ if (!includeContainers.isEmpty() &&
!includeContainers.contains(containerID)) {
+ return true;
+ }
Review Comment:
_ContainerBalancerTask.java_ calls _getContainerIDSet_ which calls
_getCandidateContainers_. _getCandidateContainers_ returns a set of contianers
suitable for the balancing process and has the following logic:
```
Set<ContainerID> idSet = nodeManager.getContainers(node);
if (includeContainers != null && !includeContainers.isEmpty()) {
idSet.retainAll(includeContainers);
}
if (excludeContainers != null) {
idSet.removeAll(excludeContainers);
}
```
This returns all candidate containers suitable for moving. Hence, if there
is an overlap here such as:
**_include-containers="1,2,3" and exclude-containers="3"_**
Then only 1 and 2 will be selected as the _excludeContainers_ logic comes
after the inclusion part.
After this the shouldBeExcluded function is called for a check before the
move (findTargetForContainerMove) .
The set of containers returned by getContainerIDSet are iterated and passed
to shouldBeExcluded. The shouldBeExcluded function follows the below rules:
- If a contianerID is found that is not part of the include list it should
automatically be excluded and hence returns true.
```
//If includeContainers is specified, exclude containers not in the include
list
if (!includeContainers.isEmpty() &&
!includeContainers.contains(containerID)) {
return true;
}
```
- If a contianer is a part of the includelist, it checks the exclusion logic
accordingly.
on the condition becoming true , the function does not move onto
_findTargetForContainerMove_ and is excluded.
The containers that return true from the shouldBeExcluded functions are
written to toRemoveContainerIds) set and are used to update the cached set.
```
// Update cached containerIDSet in setMap
sourceContainerIDSet.removeAll(toRemoveContainerIds);
```
--
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]