ChenSammi commented on code in PR #9858:
URL: https://github.com/apache/ozone/pull/9858#discussion_r2910428589
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/policy/DefaultContainerChoosingPolicy.java:
##########
@@ -69,21 +160,26 @@ public ContainerData chooseContainer(OzoneContainer
ozoneContainer,
return null;
}
- // Calculate the actual threshold
- final List<VolumeFixedUsage> volumeUsages = getVolumeUsages(volumeSet,
deltaMap);
- final double actualThreshold = getIdealUsage(volumeUsages) +
thresholdPercentage / 100.0;
-
- // Find container
- final SpaceUsageSource.Fixed dstUsage = dst.getCurrentUsage();
+ final SpaceUsageSource.Fixed dstSpaceUsage = dstUsage.getUsage();
final long dstCommittedBytes = dst.getCommittedBytes();
+ final long usableSpace = dstUsage.computeUsableSpace();
+
while (itr.hasNext()) {
ContainerData containerData = itr.next().getContainerData();
+
+ // Skip containers removed from containerSet after iterator was cached
+ if
(ozoneContainer.getContainerSet().getContainer(containerData.getContainerID())
== null) {
+ continue;
+ }
+
if (containerData.getBytesUsed() > 0 &&
!inProgressContainerIDs.contains(ContainerID.valueOf(containerData.getContainerID()))
&&
(containerData.isClosed() || (test &&
containerData.isQuasiClosed()))) {
- // Check if dst can accept the candidate container.
- if (computeUtilization(dstUsage, dstCommittedBytes,
containerData.getBytesUsed()) < actualThreshold) {
+ long containerSize = containerData.getBytesUsed();
+ // Check if dst has enough space and can accept the container without
exceeding threshold
+ if (containerSize <= usableSpace &&
Review Comment:
containerSize <= usableSpace, let's use "<" here.
--
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]