Gargi-jais11 commented on code in PR #11965:
URL: https://github.com/apache/ozone/pull/11965#discussion_r4595950882
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -544,6 +544,12 @@ public BackgroundTaskResult call() {
LOG.warn("Container {} is in {} state, skipping move process.",
containerId, containerState);
return BackgroundTaskResult.EmptyTaskResult.newResult();
}
+ if (sourceVolume.getStorageType() != destVolume.getStorageType()) {
+ LOG.warn("Container {}: Source volume storage type ({}) differs from
destination volume storage type ({}). "
+ + "Skipping the disk balancing move.",
+ containerId, sourceVolume.getStorageType(),
destVolume.getStorageType());
+ return BackgroundTaskResult.EmptyTaskResult.newResult();
+ }
Review Comment:
Thanks @devmadhuu for the fix. This makes sense, but don't u think we should
fail fast in `getTasks()` instead of queuing a task and rejecting it inside
`DiskBalancerTask.call()`.
As it stands, a cross type candidate from a custom policy still gets the
full task treatment before it's thrown away:
- it is added to the queue and uses one of the parallelThread slots;
- it is added to inProgressContainers and changes deltaSizes;
- call() looks up the container and takes its read lock;
- only then does the storage-type check run, and postCall undoes all of the
above.
The storagetype check needs only the two volumes from the
ContainerCandidate. It doesn't need the container or its lock, so it can run as
soon as the policy returns:
```
if (toBalanceContainer != null && sourceVolume.getStorageType() !=
destVolume.getStorageType()) {
LOG.warn("Container {}: Source volume storage type ({}) differs from
destination volume storage type ({}). "
+ "Skipping the disk balancing move.",
toBalanceContainer.getContainerID(),
sourceVolume.getStorageType(), destVolume.getStorageType());
// The policy reserved space on the destination; no task will be created
to release it in postCall.
destVolume.incCommittedBytes(0 - toBalanceContainer.getBytesUsed());
} else if (toBalanceContainer != null) {
// existing task creation
}
```
--
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]